[英]Elasticsearch 2.x to 5.x query issue
下面的查询需要从2.x版本更改为5.x版本。
filtered => bool
但是应该不支持多个查询。
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"bool": {
"must": [{
"query": {
"match": {
"valid": "Y"
}
}
}],
"should": [
{ "query": { "wildcard": { "name": { "value": '*' + searchValue + '*' } } } },
{ "query": { "wildcard": { "fisrtname": { "value": '*' + searchValue + '*' } } } }
]
}
}
}
},
"sort": [{
"name": {
"order": "asec"
}
}],
"from": 0,
"size": 15
像这样:
{
"query": {
"bool": {
"filter": {
"bool": {
"must": [
{
"match": {
"valid": "Y"
}
}
],
"should": [
{
"wildcard": {
"name": {
"value": "searchValue"
}
}
},
{
"wildcard": {
"firstname": {
"value": "searchValue"
}
}
}
]
}
}
}
},
"sort": [
{
"name": {
"order": "asc"
}
}
],
"from": 0,
"size": 15
}
第一个bool.filter包装器是这样,因此所有内容都被视为过滤器,不会被评分并且可能会被缓存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.