Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fetching flattened subfields #70605

Closed
jtibshirani opened this issue Mar 20, 2021 · 1 comment · Fixed by #70916
Closed

Support fetching flattened subfields #70605

jtibshirani opened this issue Mar 20, 2021 · 1 comment · Fixed by #70916
Assignees
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@jtibshirani
Copy link
Contributor

jtibshirani commented Mar 20, 2021

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"]
}]
@jtibshirani jtibshirani added >enhancement needs:triage Requires assignment of a team area label :Search/Search Search-related issues that do not fall into other categories and removed needs:triage Requires assignment of a team area label labels Mar 20, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Mar 20, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@cbuescher cbuescher self-assigned this Mar 25, 2021
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this issue Mar 26, 2021
Currently the `fields` API fetches the root flattened field and returns it in a
structured way in the response. In addition this change makes it possible to
directly query subfields. However, requesting flattened subfields via wildcard
patterns is not possible.

Closes elastic#70605
cbuescher pushed a commit that referenced this issue Apr 15, 2021
Currently the `fields` API fetches the root flattened field and returns it in a
structured way in the response. In addition this change makes it possible to
directly query subfields. However, requesting flattened subfields via wildcard
patterns is not possible.

Closes #70605
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this issue Apr 15, 2021
Currently the `fields` API fetches the root flattened field and returns it in a
structured way in the response. In addition this change makes it possible to
directly query subfields. However, requesting flattened subfields via wildcard
patterns is not possible.

Closes elastic#70605
cbuescher pushed a commit that referenced this issue Apr 15, 2021
Currently the `fields` API fetches the root flattened field and returns it in a
structured way in the response. In addition this change makes it possible to
directly query subfields. However, requesting flattened subfields via wildcard
patterns is not possible.

Closes #70605
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants