Skip to content

Fields API won't extract field that begins with the name of an object #65499

@nik9000

Description

@nik9000

Check it out:

curl -XDELETE -HContent-Type:application/json -uelastic:password localhost:9200/test

curl -XPOST -HContent-Type:application/json -uelastic:password localhost:9200/test/_doc?refresh -d'{
  "foo": {
    "cat": "meow"
  },
  "foo.bar": "baz"
}'

curl -XPOST -HContent-Type:application/json -uelastic:password localhost:9200/test/_search?pretty -d'{
  "fields": ["foo.bar"]
}'

Makes this:

{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "test",
        "_id" : "kyfg_3UBbogJq0WOeKye",
        "_score" : 1.0,
        "_source" : {
          "foo" : {
            "cat" : "meow"
          },
          "foo.bar" : "baz"
        }
      }
    ]
  }
}

Notice no fields in the response. This seems to be because we found the foo object and didn't find bar inside it. I'm not sure though. It seems like we should find foo.bar.

These kinds of documents are confusing in general and folks probably shouldn't be sending them to us. I think generally if we get them it is because someone made a mistake in their application. But we should still handle them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search/SearchSearch-related issues that do not fall into other categories>bugTeam:SearchMeta label for search team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions