我对 ElasticSearch 相当陌生,并且对停用词有疑问。我有一个索引,其中包含美国的州名……例如:纽约/纽约、加利福尼亚/加利福尼亚、俄勒冈/俄勒冈。我相信俄勒冈州的缩写,“OR”是一个停用词,所以当我将状态数据插入索引时,我无法搜索“OR”。有没有办法为此设置自定义停用词,或者我做错了什么?
这是我构建索引的方式:
    curl -XPUT http://localhost:9200/test/state/1 -d '{"stateName": ["California","CA"]}'
    curl -XPUT http://localhost:9200/test/state/2 -d '{"stateName": ["New York","NY"]}'
    curl -XPUT http://localhost:9200/test/state/3 -d '{"stateName": ["Oregon","OR"]}'
搜索“NY”,效果很好。前任:
    curl -XGET 'http://localhost:9200/test/state/_search?pretty=1'  -d '
    {
      "query" : {
         "match" : {
         "stateName" : "NY"
         }
      }
    }'
但搜索“或”,返回零命中:
    curl -XGET 'http://localhost:9200/test/state/_search?pretty=1'  -d '
    {
       "query" : {
          "match" : {
             "stateName" : "OR"
          }
       }
    }'
我相信这个搜索不会返回任何结果,因为 OR 是停用词,但我不知道如何解决这个问题。谢谢你的帮助。