小编use*_*474的帖子

Elasticsearch Map对not_analyzed文档不敏感

我有一个带有以下映射的类型

PUT /testindex
{
    "mappings" : {
        "products" : {
            "properties" : {
                "category_name" : {
                    "type" : "string",
                    "index" : "not_analyzed" 
                }
            }
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

我想搜索一个确切的单词.这就是为什么我把它设置为not_analyzed.但问题是我想用小写或大写搜索[不区分大小写].

我搜索它并找到了一种设置不区分大小写的方法.

curl -XPOST localhost:9200/testindex -d '{
  "mappings" : {
    "products" : {
      "properties" : {        
        "category_name":{"type": "string", "index": "analyzed", "analyzer":"lowercase_keyword"}
      }
    }
  }
}'
Run Code Online (Sandbox Code Playgroud)

有没有办法将这两个映射到同一个字段.

谢谢..

elasticsearch

25
推荐指数
3
解决办法
2万
查看次数

标签 统计

elasticsearch ×1