Skip to content

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

Merged
cbuescher merged 2 commits intoelastic:masterfrom
cbuescher:nested-field-api-docs
Feb 9, 2021
Merged

[Docs] Add nested fields handling in fields API#68657
cbuescher merged 2 commits intoelastic:masterfrom
cbuescher:nested-field-api-docs

Conversation

@cbuescher
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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