elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
69.4k stars 24.56k forks source link

Percolating on a field having a context suggester field is failing #47078

Open fhalde opened 4 years ago

fhalde commented 4 years ago

ElasticSearch Version: 7.2 JDK - 12 OS - Ubuntu

We are migrating to ES 7.2

This is a trimmed down mapping of ours [relevant to this issue]

{
  "properties": {
    "query": { "type":  "percolator" },
    "meta": {
      "properties": {
        "language": {
          "type": "text",
          "fields": {
            "autocomplete": {
              "max_input_length": 15,
              "analyzer": "string_analyzer",
              "preserve_position_increments": true,
              "contexts": [
                {
                  "path": "_domain",
                  "name": "_domain",
                  "type": "CATEGORY"
                }
              ],
              "type": "completion",
              "preserve_separators": false
            }
          }
        }
      }
    }
  }
}

We make use of fields to create additional fields for autocompletion

Now percolation worked fine on the language field in 1.7 with a similar mapping [whatever the mapping spec was for 1.7 suggesters], but when we try percolating a document with language field

{
  "query": {
    "bool": {
      "filter": [
        {
          "percolate": {
            "document_type": null,
            "field": "query",
            "documents": [
              {
                  "meta.language": "Russian"
              }
            ],
            "boost": 1
          }
        }
      ],
      "adjust_pure_negative": true,
      "boost": 1
    }
  },
  "_source": false
}

ES throws this error

"type":"illegal_argument_exception",
"reason":"Contexts are mandatory in context enabled completion field [meta.language.autocomplete]"

I don't get why ES is choosing meta.language.autocomplete key when I clearly provided meta.language key in the document

Is this a bug?

elasticmachine commented 4 years ago

Pinging @elastic/es-search

elasticsearchmachine commented 1 month ago

Pinging @elastic/es-search-relevance (Team:Search Relevance)