Elasticsearch的或且非及其组合
生活随笔
收集整理的這篇文章主要介紹了
Elasticsearch的或且非及其组合
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Elasticsearch的或且非及其組合
2 且
GET /my_store/products/_search {"query" :{"bool" : {"must" : [{ "term" : {"price" : 20}}, { "term" : {"productID" : "XHDK-A-1293-#fJ3"}} ]}} }3 非
GET /my_store/products/_search {"query" :{"bool" : {"must_not" : {"term" : {"price" : 30} }}} }4 實現(xiàn)類似:
select * from products where (price = 20 or productID = '11111') and price != 30 GET /my_store/products/_search {"query" :{"bool" : {"should" : [{ "term" : {"price" : 20}}, { "term" : {"productID" : "XHDK-A-1293-#fJ3"}} ],"must_not" : {"term" : {"price" : 30} }}} }實現(xiàn)類似:
select * from products where productID = '11111' or (productID = '22222' and price = 30) GET /my_store/products/_search {"query" :{"bool" : {"should" : [{ "term" : {"productID" : "XHDK-A-1293-#fJ3"}},{ "bool" : { "must" : [{ "term" : {"productID" : "JODL-X-1937-#pV7"}}, { "term" : {"price" : 30}} ]}}]}} }實現(xiàn)類似:
select * from products where categaryID = '0301' and (productID = '11111' or (productID = '22222' and price = 30)) GET /my_store/products/_search {"query" :{"bool" : {"must" : [{ "term" : {"categaryID " : "0301"}},{ "bool" : { "should" : [{ "term" : {"productID" : "11111"}},{"bool" : {"must" : [{"term" : {"productID " : "22222"}},{"term" : {"price" : 30}}]}}]}}]}} }總結(jié)
以上是生活随笔為你收集整理的Elasticsearch的或且非及其组合的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Spring-data-redis 反序
- 下一篇: Dwg图纸属性的读取