-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Currently we allow fetching the root flattened field through "fields": ["flattened_field"]. We should also allow fetching its subfields. For example, specifying "fields": ["flattened_field.subfield1"] would return a response like this:
"fields": [{
"flattened_field.subfield1": ["value1"]
}]
We allow flattened subfields to be used in queries, aggregations, and even docvalue_fields, so this enhancement would make sure the fields option behaves consistently. These subfields would only be returned when they're explicitly requested. This follows the same behavior as other parts of the search API, where field wildcard patterns only match against the root flattened field and not its subfields (which aren't technically in the mapping).
Note that if you retrieve both the root flattened field and a subfield, the response might contain the same data twice. This could be a little surprising, but seems like okay behavior to me. For example, "fields": ["flattened_field", "flattened_field.subfield1"] might return the following:
"fields": [{
"flattened_field": [{
"subfield1": "value1",
"subfield2": "value2"
}],
"flattened_field.subfield1": ["value1"]
}]