精确查找:term
{
"term" : {
"price" : 20
}
}
term查询文本时,如果文本是类似productID = "XHDK-A-1293-#fJ3"的形式,es会将该文本拆分成4个token,所以要在建立索引的时候,设置成not_analyzed模式。形如:
DELETE /my_store
PUT /my_store
{
"mappings" : {
"products" : {
"properties" : {
"productID" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}
组合:
{
"bool" : {
"must" : [],
"should" : [],
"must_not" : [],
}
}
must
所有的语句都 必须(must) 匹配,与 AND 等价。
must_not
所有的语句都 不能(must not) 匹配,与 NOT 等价。
should
至少有一个语句要匹配,与 OR 等价。