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

Add support for storing JSON fields. #34942

Merged
merged 2 commits into from
Oct 30, 2018

Conversation

jtibshirani
Copy link
Contributor

@jtibshirani jtibshirani commented Oct 27, 2018

When 'store' is enabled, a single stored field is added containing the entire JSON object in pretty-printed format.

@cbuescher cbuescher added the WIP label Oct 29, 2018
@jtibshirani jtibshirani force-pushed the store-json-fields branch 4 times, most recently from 7794870 to 59bd0ca Compare October 29, 2018 19:11
@jtibshirani jtibshirani added >feature :Search Foundations/Mapping Index mappings, including merging and defining field types and removed WIP labels Oct 29, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

if (fieldType().indexOptions() != IndexOptions.NONE) {
XContentParser indexedFieldsParser = context.parser();

// If store is enabled, we've already consumed the content to produce the stored field. Here we
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The alternative here would be to add logic to JsonFieldParser to generate the stored field as it's parsed. Although it avoids parsing the input twice as we do here, that approach turned turned out fairly messy and didn't separate out concerns as nicely. It also seems uncommon to enable stored fields, so I wasn't as concerned about the fact we will parse the input twice.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, I don't think its worth the complexity of trying to produce the stored field content in the same pass as the index field for the rare case that the field is stored.

Copy link
Contributor

@colings86 colings86 left a comment

Choose a reason for hiding this comment

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

LGTM

@jtibshirani jtibshirani merged commit 71f776e into elastic:object-fields Oct 30, 2018
@jtibshirani jtibshirani deleted the store-json-fields branch October 30, 2018 15:39
jtibshirani added a commit to jtibshirani/elasticsearch that referenced this pull request Nov 8, 2018
jtibshirani added a commit to jtibshirani/elasticsearch that referenced this pull request Nov 9, 2018
jtibshirani added a commit to jtibshirani/elasticsearch that referenced this pull request Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>feature :Search Foundations/Mapping Index mappings, including merging and defining field types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants