我尝试在人的索引上搜索(按名称和姓氏),此部分非常简单:
GET /my_index/persons/search
{
"query": {
"query_string": {
"query" : "john doe"
}
}
}
此外,我想排除具有特定ID的人,我尝试了filter
子句,但我无法正确形成查询,你们能帮我吗?
编辑
我尝试过
{
"query":{
"multi_match":{
"query":"anne mirande",
"fields":[
"first_name",
"last_name"
],
"type":"cross_fields",
"operator":"and"
}
},
"filter":{
"not":{
"term":{
"id":1
}
}
}
}
但是,它是:在[filter]中的start_object的未知键。
您可以使用类似的东西。
GET /my_index/persons/search
{
"query": {
"bool": {
"must": [
{"term": {
"name": {
"value": "john doe"
}
}}
],
"must_not": [
{"term": {
"_id": {
"value": "1"
}
}}
]
}
}
}