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

[Docs] Add nested fields handling in fields API #68657

Merged
merged 2 commits into from
Feb 9, 2021

Conversation

cbuescher
Copy link
Member

This change adds a paragraph on the different response format for nested fields
in the fields API and adds an example snippet.

Related to #63709

This change adds a paragraph on the different response format for nested fields
in the fields API and adds an example snippet.

Related to elastic#63709
@cbuescher cbuescher added :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0 v7.12.0 labels Feb 8, 2021
@cbuescher cbuescher requested a review from jtibshirani February 8, 2021 13:30
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Feb 8, 2021
@elasticmachine
Copy link
Collaborator

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

Copy link
Contributor

@jtibshirani jtibshirani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems clear and concise!


The `fields` response for <<nested,`nested` fields>> is slightly different from that
of regular object fields. While leaf values inside regular `object` fields are
returned as a flat list, values inside `nested` fields are grouped according
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be some missing words here: "grouped according to maintain the independence" ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably I was thinking about an adverb like " values inside nested fields are grouped accordingly
to maintain the independence of each object inside the original nested array." But reading it again now I think just leaving it simply " values inside nested fields are grouped to maintain the independence of each object inside the original nested array.", wdyt as a native speaker? Does any of this make more sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see now, 'accordingly' makes more sense. To me your second option is a bit clearer: "are grouped to maintain the independence..."

Copy link
Contributor

@jtibshirani jtibshirani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the back-and-forth, I noticed a couple more things after chatting with Kibana developers.


[source,console]
--------------------------------------------------
PUT my-index-000001
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be clearer to explicitly map the subfields as we do in other places. That way users aren't wondering "what are these new .keyword fields"?

of regular object fields. While leaf values inside regular `object` fields are
returned as a flat list, values inside `nested` fields are grouped according
to maintain the independence of each object inside the original nested array.
For each entry inside a nested field array, values are again returned as a flat list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some early adopters expressed confusion over what the structure is for requests other than *. We could add a line like "The nested fields will be grouped by their nested paths, no matter what the pattern used to retrieve them" maybe even with an example?

@cbuescher
Copy link
Member Author

@jtibshirani thanks for the additional remarks, I pushed some additions. Let me know if you are okay to merge like this.

@cbuescher cbuescher merged commit 8fff763 into elastic:master Feb 9, 2021
cbuescher pushed a commit that referenced this pull request Feb 9, 2021
This change adds a paragraph on the different response format for nested fields
in the fields API and adds an example snippet.

Related to #63709
@williamrandolph williamrandolph added the >docs General docs changes label Feb 18, 2021
@elasticmachine elasticmachine added the Team:Docs Meta label for docs team label Feb 18, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>docs General docs changes :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Docs Meta label for docs team Team:Search Meta label for search team v7.12.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants