-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Source Filtering does not Expose Field Names with Dots #20719
Comments
This is related to elastic/elasticsearch-hadoop#854. I spoke with @rjernst about the situation and he recommended that we switch to using the |
+1 for consistency |
Mappings treat dots in field names as sub objects, for instance ``` { "a.b": "c" } ``` generates the same dynamic mappings as ``` { "a": { "b": "c" } } ``` Source filtering should be consistent with this behaviour so that an include list containing `a` should include fields whose name is `a.b`. To make this change easier, source filtering was refactored to use automata. The ability to treat dots in field names as sub objects is provided by the `makeMatchDotsInFieldNames` method of `XContentMapValues`. Closes elastic#20719
…0736) Mappings treat dots in field names as sub objects, for instance ``` { "a.b": "c" } ``` generates the same dynamic mappings as ``` { "a": { "b": "c" } } ``` Source filtering should be consistent with this behaviour so that an include list containing `a` should include fields whose name is `a.b`. To make this change easier, source filtering was refactored to use automata. The ability to treat dots in field names as sub objects is provided by the `makeMatchDotsInFieldNames` method of `XContentMapValues`. Closes #20719
…0736) Mappings treat dots in field names as sub objects, for instance ``` { "a.b": "c" } ``` generates the same dynamic mappings as ``` { "a": { "b": "c" } } ``` Source filtering should be consistent with this behaviour so that an include list containing `a` should include fields whose name is `a.b`. To make this change easier, source filtering was refactored to use automata. The ability to treat dots in field names as sub objects is provided by the `makeMatchDotsInFieldNames` method of `XContentMapValues`. Closes #20719
Elasticsearch version: 5.0.0-beta1
Plugins installed: []
JVM version: 1.8.0_91
Description of the problem including expected versus actual behavior:
In certain cases of using source filtering on field names that contain dots, results that are inconsistent can be returned. My understanding of the source filtering is that it is strictly a filter that is applied over the source document as is.
Steps to reproduce:
curl -XPUT localhost:9200/dots/test/1 -d '{"a.b":0,"c":1,"d":{"e":2}}'
curl -XPOST 'localhost:9200/dots/test/_search?_source=a,c,d'
"hits" : [ { "_index" : "dots", "_type" : "test", "_id" : "1", "_score" : 1.0, "_source" : { "c" : 1, "d" : { "e" : 2 } } } ]
a
field using a wild card:curl -XPOST 'localhost:9200/dots/test/_search?_source=a.*,c,d'
"hits" : [ { "_index" : "dots", "_type" : "test", "_id" : "1", "_score" : 1.0, "_source" : { "c" : 1, "a.b" : 0, "d" : { "e" : 2 } } } ]
Worth Mentioning:
a.b
as a json object, the fields from that document come back in source filtered queries:curl -XPUT localhost:9200/dots/test/2 -d '{"a":{"b":5}}'
curl -XPOST 'localhost:9200/dots/test/_search?_source=a,c,d&pretty'
"hits" : [ { "_index" : "dots", "_type" : "test", "_id" : "1", "_score" : 1.0, "_source" : { "c" : 1, "d" : { "e" : 2 } } }, { "_index" : "dots", "_type" : "test", "_id" : "2", "_score" : 1.0, "_source" : { "a" : { "b" : 5 } } } ]
Describe the feature:
My understanding is that the source filter works only on the raw source field. In the above case the field
a
does not exist in the original document, only the fielda.b
. Since"a.b" != "a"
the field is ignored. The discussion that I want to whip up about this is whether or not the source filter logic should be consistent with the rest of Elasticsearch in how it handles parsing of dotted field names before checking if they match a source filter.Edit: Removed a bogus reproduction step.
The text was updated successfully, but these errors were encountered: