-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Not all meta fields in _source print a nice error #24422
Comments
I agree that the message is a bit confusing since we usually fail any document that contain a metadata field. Though |
Hello, if @narph is not available to submit a PR, I am interested in handling this issue. |
@asettouf sure go for it, I'd be happy to review ! |
Note that |
So for beginning I have just added "_field_names" in the Am I right to understand that to use the I'd love to do the refactoring, now as I am new, I would just like some guidance on what would be the best way (perhaps I've missed a much smarter way of refactoring) to proceed before I start breaking everything! |
@asettouf The |
@elastic/es-search-aggs |
I guess the existing PR for this issue is closed now. Can I work on this issue ? |
@Rijul1204 Please feel free to work on this, or any other issue. Those labeled with |
Hi, as there has been no activity for some time, can I pick this issue? |
@sandmannn, Sure please proceed. I am not currently working on it. |
Hi @rjernst , you mentioned in your reply before, I looked at several places (constructor of |
The |
Thanks for your suggestion, @rjernst ! I think it is the only possible way to proceed here. As number of classes affected seems to be slightly bigger than originally expected, lets maybe address the necessary class changes one by one. I looked for usages of |
I was looking up various chains of funciton calling of
is going up the call chain up to creation of a |
For DocumentField, I would make this a member variable that is set on construction. The |
FTIW, passing the boolean to the DocumentField constructor should be relatively simple: see FetchPhase.getSearchFields. This method has SearchContext, which has a ref to the MapperService. |
Assuming it was already written during serialization indeed makes it much simpler. 2 questions though:
|
|
sure, lets add instance methods first. Does it mean that in the scope of the first PR we just adding the instance equivalents of
Both options look ugly, but in different ways. What do you prefer? |
I don't think we need to have both static and instance methods at the same time. My suggestion is to convert the uses of the meta fields checking to first call the existing static methods directly, instead of indirectly through wrapped layers. For example, a first PR can change the constructor of DocumentField to take a boolean indicating whether or not the field is a metadata field. All the calls to the constructor would be changed to pass this statically (eg with percolator), or by calling the existing static method on MapperService. A second PR would then change those static method callers to check on the MapperService instance (and at the same time change to an instance method). |
This commit makes creators of GetField split the fields into document fields and metadata fields. It is part of larger refactoring that aims to remove the calls to static methods of MapperService related to metadata fields, as discussed in elastic#24422.
This commit makes creators of GetField split the fields into document fields and metadata fields. It is part of larger refactoring that aims to remove the calls to static methods of MapperService related to metadata fields, as discussed in #24422.
This commit makes creators of GetField split the fields into document fields and metadata fields. It is part of larger refactoring that aims to remove the calls to static methods of MapperService related to metadata fields, as discussed in elastic#24422.
@rjernst Can I work on this issue? |
Hi, as mentioned in the discussion in the last commit #41656 I will not have capacity to contribute at least in the next 3-6 months starting from the April 2020. so as of now everybody is welcome to take over this broader refactoring. |
Refactor SearchHit to have separate document and meta fields. This is a part of bigger refactoring of issue elastic#24422 to remove dependency on MapperService to check if a field is metafield. Relates to PR: elastic#38373 Relates to issue elastic#24422
Refactor SearchHit to have separate document and meta fields. This is a part of bigger refactoring of issue #24422 to remove dependency on MapperService to check if a field is metafield. Relates to PR: #38373 Relates to issue #24422 Co-authored-by: sandmannn <[email protected]>
Before to determine if a field is meta-field, a static method of MapperService isMetadataField was used. This method was using an outdated static list of meta-fields. This PR instead changes this method to the instance method that is also aware of meta-fields in all registered plugins. This PR also refactors DocumentField to add a new parameter to the constructor of DocumentField isMetadataField which describes whether this is metadata field or not. This refactoring is necessary as there is no more statiic method to check if a field is meta-field, but DocumentField objects are always created from the contexts where this information is available, and will be passed to DocumentField constructor for further usage. Related elastic#38373, elastic#41656 Closes elastic#24422
Before to determine if a field is meta-field, a static method of MapperService isMetadataField was used. This method was using an outdated static list of meta-fields. This PR instead changes this method to the instance method that is also aware of meta-fields in all registered plugins. Related elastic#38373, elastic#41656 Closes elastic#24422
Before to determine if a field is meta-field, a static method of MapperService isMetadataField was used. This method was using an outdated static list of meta-fields. This PR instead changes this method to the instance method that is also aware of meta-fields in all registered plugins. Related #38373, #41656 Closes #24422
Before to determine if a field is meta-field, a static method of MapperService isMetadataField was used. This method was using an outdated static list of meta-fields. This PR instead changes this method to the instance method that is also aware of meta-fields in all registered plugins. Related elastic#38373, elastic#41656 Closes elastic#24422
Before to determine if a field is meta-field, a static method of MapperService isMetadataField was used. This method was using an outdated static list of meta-fields. This PR instead changes this method to the instance method that is also aware of meta-fields in all registered plugins. Related #38373, #41656 Closes #24422
Given this example:
We get different messages for adding meta fields in the root of
_source
e.g look at_index
vs_field_names
The text was updated successfully, but these errors were encountered: