0
此使用是一个代码Elasticsearch含义必须multimatch
GET /news/_search
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "France and Luxembourg",
"fields": [
"stkno",
"tag",
"content",
"htext"
],
"operator": "and"
}
},
{
"range": {
"CDate": {
"gt": "2017-05-23T14:02:11",
"lte": "2017-05-24T23:59:59"
}
}
}
]
}
},
"from": 0,
"size": 100,
"sort": [
{
"CDate": {
"order": "desc"
}
}
]
}
使用上面的命令后,打总为2分的记录。但其中一个确切地说'法国和卢森堡',另外一个'法国'。
我的问题如下:
- 已经使用了“必须”,为什么没有只显示确切词“法国和卢森堡”?
- 运营商的目的是什么?我已经读过elasticsearch,但真的不明白,你能解释一下吗?
重新编辑:
我一直在使用如下编码尝试,但结果变成空的。 enter code here
POST _search
{
"query": {
"bool": {
"should": [
{
"term": {
"stkno": "France and Luxembourg"
}
},
{
"term": {
"tag": "France and Luxembourg"
}
},
{
"term": {
"context": "France and Luxembourg"
}
},
{
"term": {
"htext": "France and Luxembourg"
}
}
],
"minimum_should_match": 1
}
}
}
感谢...
我已经试过您的建议编码..但我不能让我的结果。总命中数为0。我将复制elasticsearch值时,它仍然无法找到 –
编码太长,我不能在这里 –
贴上编码,如:POST _search { “查询”:{ “布尔”:{ “应“:[ {请按照上面的代码进行编码)}} –