[英]How to convert this elasticsearch query from 2.x to 5.x index?
我們的系統將elasticsearch從2.x升級到了5.x。 現在查詢無法在以2.x編寫的5.x中工作。 所以我必須將Elasticsearch查詢從2.x轉換為5.x索引嗎?
請建議如何將該查詢轉換為elasticsearch 5.x查詢? _score字段將不受影響,並且可以緩存此查詢。
{
"size": 12,
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"pageType": "ulp_comb"
}
},
{
"range": {
"date": {
"gte": "2017-09"
}
}
}
],
"must_not": [
{
"term": {
"entityId": 0
}
}
]
}
}
}
}
}
您只需要更改filtered
為bool
{
"size": 12,
"query": {
"bool": { // change to bool
"filter": {
"bool": {
"must": [
{
"term": {
"pageType": "ulp_comb"
}
},
{
"range": {
"date": {
"gte": "2017-09"
}
}
}
],
"must_not": [
{
"term": {
"entityId": 0
}
}
]
}
}
}
}
}
希望能幫助到你
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.