将Elasticsearch REST API与浏览器结合使用:如何进行AND操作



我想知道如何在localhost:9200 上使用浏览器搜索2个键:值对

例如:想要组合国家=CAN和品牌=V

_source": {
    "country": "CAN",
    "brand": "V",
    "leadID": 10333,
    "datetime": 1442247315000
}
... and so on

我在"default_operator"设置为AND:的情况下尝试了这个uri

http://localhost:9200/_search?default_operator=AND&q=country:CAN&q=brand:V

在回复中,我得到了品牌=V的country=CAN,但我也得到了品牌=V的country=PRT。所以它做了一个OR运算,而不是AND运算。

尝试此http://localhost:9200/_search?default_operator=AND&q=country:CAN AND brand:V

您的浏览器会将其翻译为http://localhost:9200/_search?default_operator=AND&q=country:CAN%20AND%20brand:V

这意味着您将两个条件合并为一个条件:q=country:CAN AND brand:V

最新更新