[英]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.