drrvnbwle80177811 2016-02-01 06:07
浏览 236
已采纳

Elasticsearch NOT带有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. Help me to fix this issue. Thanks in advance.

Below is my code OR operation with 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

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

1条回答 默认 最新

  • doudi8829 2016-02-03 11:28
    关注

    I found the answer for my question for AND operation

    AND NOT(et_tax:\"Hotel,Leisure & Hospitality\" AND et_tax:\"Mergers & Acquisitions\")

    For OR operation

    AND NOT(et_tax:\"Hotel,Leisure & Hospitality\" OR et_tax:\"Mergers & Acquisitions\")

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改