Skip to content

Commit b7450c2

Browse files
committed
Make patterned_text not aggregatable
1 parent 4a3ba41 commit b7450c2

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

x-pack/plugin/mapper-patterned-text/src/main/java/org/elasticsearch/xpack/patternedtext/PatternedTextFieldType.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ public class PatternedTextFieldType extends StringFieldType {
6464
private final TextFieldMapper.TextFieldType textFieldType;
6565

6666
PatternedTextFieldType(String name, TextSearchInfo tsi, Analyzer indexAnalyzer, boolean isSyntheticSource, Map<String, String> meta) {
67-
super(name, true, false, true, tsi, meta);
67+
// Though this type is based on doc_values, hasDocValues is set to false as the patterned_text type is not aggregatable.
68+
// This does not stop its child .template type from being aggregatable.
69+
super(name, true, false, false, tsi, meta);
6870
this.indexAnalyzer = Objects.requireNonNull(indexAnalyzer);
6971
this.textFieldType = new TextFieldMapper.TextFieldType(name, isSyntheticSource);
7072
}

x-pack/plugin/mapper-patterned-text/src/yamlRestTest/resources/rest-api-spec/test/10_basic.yml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Field caps:
4545
fields: [ foo ]
4646

4747
- match: { fields.foo.text.searchable: true }
48-
- match: { fields.foo.text.aggregatable: true }
48+
- match: { fields.foo.text.aggregatable: false }
4949

5050
---
5151
Exist query:
@@ -267,26 +267,6 @@ Wildcard highlighting:
267267
- match: { hits.hits.0._source.foo: "Found 5 errors for service [cheddar1]" }
268268
- match: { hits.hits.0.highlight.foo.0: "Found <em>5</em> errors for service [cheddar1]" }
269269

270-
---
271-
Terms aggregation:
272-
- do:
273-
search:
274-
index: test
275-
body:
276-
aggs:
277-
term_agg:
278-
terms:
279-
field: foo
280-
281-
- match: { hits.total.value: 4 }
282-
- length: { aggregations.term_agg.buckets: 3 }
283-
- match: { aggregations.term_agg.buckets.0.key: "Found 5 errors for service [cheddar1]"}
284-
- match: { aggregations.term_agg.buckets.0.doc_count: 1 }
285-
- match: { aggregations.term_agg.buckets.1.key: "Found some errors for cheddar data service"}
286-
- match: { aggregations.term_agg.buckets.1.doc_count: 1 }
287-
- match: { aggregations.term_agg.buckets.2.key: "[2020-08-18T00:58:56] Found 123 errors for service [cheddar1]"}
288-
- match: { aggregations.term_agg.buckets.2.doc_count: 1 }
289-
290270
---
291271
tsdb:
292272

0 commit comments

Comments
 (0)