Our system upgraded elasticsearch from 2.x to 5.x. Now query's are not working in 5.x written in 2.x. So I have to convert elasticsearch query from 2.x to 5.x index?
Please suggest how to convert this query to elasticsearch 5.x query? _score field will not be affected and able to cache this query.
{
"size": 12,
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"pageType": "ulp_comb"
}
},
{
"range": {
"date": {
"gte": "2017-09"
}
}
}
],
"must_not": [
{
"term": {
"entityId": 0
}
}
]
}
}
}
}
}
You just need to change filtered
to 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
}
}
]
}
}
}
}
}
Hope it helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.