简体   繁体   English

使用AND和OR进行弹性搜索NOT布尔运算

[英]Elastic search NOT boolean opeation with AND and OR

I want to include and exclude the expertise using AND and OR ,Include with AND and OR operation working fine.But when using exclude expertise with AND and OR ,returns the same result count as 3. I am using elastic search version 1.4. 我想使用AND和OR来包括和排除专业知识,包括AND和OR的工作正常。但是当使用AND和OR来使用排除专业知识时,返回的结果计数与3相同。我正在使用弹性搜索1.4版。 Help me to fix this issue. 帮助我解决此问题。 Thanks in advance. 提前致谢。

Below is my code OR operation with NOT 下面是我的代码或带有NOT的操作

{
  "query_string": {
    "query": "et_tax:\"Commercial\" et_tax: \"Technology, Media & Telecoms\" AND ( -et_tax:\"Hotel,Leisure & Hospitality\" OR  -et_tax:\"Mergers & Acquisitions\")"
  }
}      

AND operation with NOT AND与NOT运算

{
  "query_string": {
    "query": "et_tax:\"Commercial\" et_tax: \"Technology, Media & Telecoms\" AND  -et_tax:\"Hotel,Leisure & Hospitality\" AND  -et_tax:\"Mergers & Acquisitions\""
  }
}

I found the answer for my question for AND operation 我找到了与操作AND问题的答案

AND NOT(et_tax:\\"Hotel,Leisure & Hospitality\\" AND et_tax:\\"Mergers & Acquisitions\\") AND NOT(et_tax:\\“酒店,休闲与款待\\” AND et_tax:\\“合并与收购\\”)

For OR operation 对于或运算

AND NOT(et_tax:\\"Hotel,Leisure & Hospitality\\" OR et_tax:\\"Mergers & Acquisitions\\") AND NOT(et_tax:\\“酒店,休闲与招待\\”或et_tax:\\“合并与收购\\”)

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

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