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

Incorrect field values returned when '.' (dot) used in property name #7112

Closed
danielcweeks opened this issue Jul 31, 2014 · 1 comment
Closed

Comments

@danielcweeks
Copy link

If two properties in a document have the same prefix up to a '.' (dot/period), then queries for the fields that include the '.' will return the same value as the prefix without.

#Delete Test Index
curl -XDELETE localhost:9200/test

#Create a document with property names similar up to a '.'
curl -XPUT http://localhost:9200/test/test/1 -d '
{
  "foo" : "val",
  "foo.bar" : "val_WILL_NOT_SHOW",
  "foo.bat" : "val_THIS_EITHER"
}'

#Query for specific fields and note the incorrect values
curl -XGET 'http://localhost:9200/test/test/_search?q=val&pretty&fields=foo,foo.bar,foo.bat'
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 0.15342641,
    "hits" : [ {
      "_index" : "test",
      "_type" : "test",
      "_id" : "1",
      "_score" : 0.15342641,
      "fields" : {
        "foo.bat" : [ "val" ],
        "foo.bar" : [ "val" ],
        "foo" : [ "val" ]
      }
    } ]
  }
}

#Same query with no fields specified
curl -XGET 'http://localhost:9200/test/test/_search?q=val&pretty'
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 0.15342641,
    "hits" : [ {
      "_index" : "test",
      "_type" : "test",
      "_id" : "1",
      "_score" : 0.15342641,
      "_source":
{
  "foo" : "val",
  "foo.bar" : "val_WILL_NOT_SHOW",
  "foo.bat" : "val_THIS_EITHER"
}
    } ]
  }
}
@clintongormley
Copy link
Contributor

Hi @dcw-netflix

Yes, we're planning on making dots in field names illegal for this reason: See #6736

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

No branches or pull requests

2 participants