简体   繁体   English

elasticsearch完全匹配,包含哈希值

[英]elasticsearch exact match containing hash value

I am facing problem with elastic search, i am using query to search data from document. 我正面临弹性搜索的问题,我正在使用查询从文档中搜索数据。 following is the query to search single data from document. 以下是从文档中搜索单个数据的查询。

"query": {
      "filtered": {
     "query": {
         "query_string": {
            "query": "'.$lotnumber.'",
            "fields": ["LotNumber"]
                           }
                      }
            }
     }
   }'

It is working fine for simple value but if $lotnumber contains any value with hash in between then it is showing all the data from document.any one here who can help me to resolve problem of searching exact value from document with hash value ?? 对于简单值,它工作正常,但是如果$ lotnumber包含介于两者之间的任何值,则它将显示来自document.all的所有数据。这里的任何人都可以帮助我解决从具有hash值的文档中搜索精确值的问题?

The first things that I would think of in this case is make the field lotnumber not-analyzed in your mapping. 在这种情况下,我首先想到的是在映射中不分析字段lotnumber。 That should do the trick. 这应该够了吧。

In your mapping 在您的映射中

"album": {
  "type": "string",
  "fields": {
    "raw": {
      "type": "string",
      "index": "not_analyzed"
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM