mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 15:17:30 -04:00
Flag in _field_caps to return only fields with values in index (#103651)
We are adding a query parameter to the field_caps api in order to filter out fields with no values. The parameter is called `include_empty_fields` and defaults to true, and if set to false it will filter out from the field_caps response all the fields that has no value in the index. We keep track of FieldInfos during refresh in order to know which field has value in an index. We added also a system property `es.field_caps_empty_fields_filter` in order to disable this feature if needed. --------- Co-authored-by: Matthias Wilhelm <ankertal@gmail.com>
This commit is contained in:
parent
5c1e3e2c91
commit
54cfce4379
35 changed files with 1130 additions and 64 deletions
|
@ -65,7 +65,6 @@
|
|||
field_caps:
|
||||
index: 'my_remote_cluster:some_index_that_doesnt_exist'
|
||||
fields: [number]
|
||||
|
||||
- match: { error.type: "index_not_found_exception" }
|
||||
- match: { error.reason: "no such index [some_index_that_doesnt_exist]" }
|
||||
|
||||
|
@ -156,3 +155,38 @@
|
|||
- length: {fields.number: 1}
|
||||
- match: {fields.number.long.searchable: true}
|
||||
- match: {fields.number.long.aggregatable: true}
|
||||
|
||||
---
|
||||
"Field caps with with include_empty_fields false":
|
||||
- skip:
|
||||
version: " - 8.12.99"
|
||||
reason: include_empty_fields has been added in 8.13.0
|
||||
- do:
|
||||
indices.create:
|
||||
index: field_caps_index_5
|
||||
body:
|
||||
mappings:
|
||||
properties:
|
||||
number:
|
||||
type: double
|
||||
empty-baz:
|
||||
type: text
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: field_caps_index_5
|
||||
body: { number: "42", unmapped-bar: "bar" }
|
||||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: [field_caps_index_5]
|
||||
- do:
|
||||
field_caps:
|
||||
include_empty_fields: false
|
||||
index: 'field_caps_index_5,my_remote_cluster:field_*'
|
||||
fields: '*'
|
||||
|
||||
- is_true: fields.number
|
||||
- is_false: fields.empty-baz
|
||||
- is_true: fields.unmapped-bar
|
||||
- is_true: fields._index
|
||||
|
|
|
@ -82,6 +82,10 @@
|
|||
nested2:
|
||||
type: keyword
|
||||
doc_values: false
|
||||
- do:
|
||||
index:
|
||||
index: field_caps_index_1
|
||||
body: { number: "42", unmapped-bar: "bar" }
|
||||
- do:
|
||||
indices.create:
|
||||
index: test_index
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue