Queries without fully qualified field names failing in the latest versions of Elasticsearch

Hi,

We are currently running Elasticsearch 1.4 and are trying to upgrade to the newer versions 7.x. As part of that effort, we noticed our queries are failing on the latest versions i.e 7.x if the fileds used in queries are not fully qualified. Is it mandatory now to provide fully qualified field names in queries now? I can't find any relevant documentation on this in Breaking changes pages.

Example:

For documents as follows,

{ 
  "region": "US",
  "manager": { 
    "age":     30,
    "name": { 
      "first": "John",
      "last":  "Smith"
    }
  }
}

with mapping as follows

{
  "mappings": {
    "properties": { 
      "region": {
        "type": "keyword"
      },
      "manager": { 
        "properties": {
          "age":  { "type": "integer" },
          "name": { 
            "properties": {
              "first": { "type": "text" },
              "last":  { "type": "text" }
            }
          }
        }
      }
    }
  }
}

the following query was working in 1.4

{
  "query": {
    "match": {
      "first": {
        "query": "John"
      }
    }
  }
}

whereas that's not returning any results in 7.x

7.x works with fully qualified field names as follows

{
  "query": {
    "match": {
      "manager.name.first": {
        "query": "John"
      }
    }
  }
}

Can someone please throw some light on this?

Just fyi, I'm talking about object field types only
https://www.elastic.co/guide/en/elasticsearch/reference/current/object.html not nested type.

I never worked with 1.4 or anything that close but as far back as I remember you need to use manager.name.first dot notation now.

1 Like

Yes. It was a bug actually that it was working previously.

That said, you can define a field alias if you don't want to change your queries.

1 Like

Thanks for confirming

Thank you for the context and the field alias suggestion. Field aliases greatly simplifies our up-gradation without waiting on the client changes. Thanks for the help.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.