How to set case_insensitive for term query in elasticsearch?

Viewed 1005

In elasticsearch term query documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html, it is stated there's a case_insensitive field

However, I can't get to set it. I can set boost and value without issue, but not case_insensitive.

GET movies/_search
{
  "query": {
    "term": {
      "overview": {
        "value" : "batman",
        "boost": 0.5,
        "case-insensitive": true
      }
    }
  }
}

When I run, I get the error state "[term] query does not support [case_insensitive]".

Where did I get it wrong, or the documentation is wrong?

1 Answers

Looks like you are on less than the ES 7.10.0 version where it was not present, Even if you check the documentation of ES 7.9 option of case_insensitive is not present.

Please find the related link of Github issue and PR which added support of case-insensitive to term query.

Please refer to this diff where caseInsensitive field was added to TermQuery.

Related