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

Modifying metadata checking in document parser to use mapperRegistry #24473

Closed
wants to merge 3 commits into from

Conversation

asettouf
Copy link

@asettouf asettouf commented May 3, 2017

Fix for issue #24422

Note that I modified a test in DocumentParserTests as it was using the field "_ttl" to check the rejection of metadata fields which is still in META_FIELDS, however not in mapperRegistry.getMetadataMapperParsers which seems correct to me given this link

One last thing is I did not remove the META_FIELDS usage as for instance it used in GetField and I am not sure how to grab correctly a reference to a MapperService.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@rjernst
Copy link
Member

rjernst commented May 3, 2017

Thanks for the PR. However, as I noted in my comment on #24422, we need the existing meta field methods on MapperService modifed, and META_FIELDS removed. This PR adds a new method and leaves other uses broken. We don't need a new method, we just need the existing method implementations fixed.

@asettouf
Copy link
Author

asettouf commented May 8, 2017

Hi @rjernst I have actually modified my modifications, as I finally understood your cue, I suppose injecting the metadatafields from the mapperRegistry into the META_FIELDS at construction time is the easiest way to get these fields. One question though, now that I have 2 different commits, should I squash them together, or create a different PR?

Many thanks for the time you take to review my work.

@@ -153,6 +153,8 @@ public MapperService(IndexSettings indexSettings, IndexAnalyzers indexAnalyzers,
this.searchQuoteAnalyzer = new MapperAnalyzerWrapper(indexAnalyzers.getDefaultSearchQuoteAnalyzer(), p -> p.searchQuoteAnalyzer());
this.mapperRegistry = mapperRegistry;

META_FIELDS = ObjectHashSet.from(mapperRegistry.getMetadataMapperParsers().keySet().toArray(new String[mapperRegistry.getMetadataMapperParsers().keySet().size()]));
Copy link
Member

Choose a reason for hiding this comment

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

I don't think there is any need to keep META_FIELDS, and this is incorrect do both because META_FIELDS is static right now (so should not be initialized in the ctor) and because it leaves the incorrect values there now. META_FIELDS should be removed completely, and the methods that use it should instead pull the keyset from mapperRegistry.

@rjernst
Copy link
Member

rjernst commented May 8, 2017

One question though, now that I have 2 different commits, should I squash them together, or create a different PR?

Making additional commits here is fine. When we have finished iterating and it is ready to merge, we will squash on merge.

@rjernst
Copy link
Member

rjernst commented Jun 13, 2017

@asettouf Are you still interested working on this?

@asettouf
Copy link
Author

@rjernst Actually you can remove me. I was unable to make every required modification, as especially grabbing a registry in GetField for checking a metadata field involves breaking and fixing a whole bunch of methods in a very inelegant way...

@rjernst
Copy link
Member

rjernst commented Aug 1, 2017

Thanks @asettouf, I will close this PR then. Please reopen in the future if you want to get back to it.

@rjernst rjernst closed this Aug 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants