ElasticSearch query查询的时候不区分大小写的设置

Elastic 默认是区分大小写查询的,比如:

{
  "foo": "BÀR"
}

查询的时候 通过“bar”是查询不到的,需要在


"settings": {

    "analysis": {
      "normalizer": {
        "my_normalizer": {
          "type": "custom",
          "filter": ["lowercase", "asciifolding"]
        }
      }
    }
  },  
   "mappings": {
    "type": {
      "properties": {
        "foo": {
          "type": "keyword",
          "normalizer": "my_normalizer"
        }
      }
    }
  }


这样就可以解决大小写的问题。

ES 6.0 官网资料:https://www.elastic.co/guide/en/elasticsearch/reference/6.0/normalizer.html

猜你喜欢

转载自blog.csdn.net/wessiyear/article/details/79281181