Hi to everybody,
I'm trying to convert a query, written for Elasticsearch 2, to Elasticsearch 5.1.1.
Es 2
{
"index": "wsx5_answers",
"type": "topics",
"body": {
"fields": ["title"],
"query": {
"filtered": {
"query": {
"match_all": []
},
"filter": {
"bool": {
"must": [{
"terms": {
"status": ["approved"]
}
}, {
"terms": {
"type": ["question", "idea", "praise", "update", "info", "bug", "faq", "tipsandtricks"]
}
}, {
"term": {
"author": 12345
}
}, {
"bool": {
"should": [{
"term": {
"public": true
}
}, {
"term": {
"author": 12345
}
}]
}
}, {
"terms": {
"lang": ["it"]
}
}]
}
}
}
},
"size": 15,
"from": 0,
"sort": {
"lastupdate": {
"order": "desc"
}
}
}
}
Es 5.1.1
{
"index": "wsx5_answers",
"type": "topics",
"body": {
"stored_fields": ["title"],
"query": {
"bool": {
"must": {
"match_all": []
},
"filter": {
"bool": {
"must": [{
"terms": {
"status": ["approved"]
}
}, {
"terms": {
"type": ["question", "idea", "praise", "update", "info", "bug", "faq", "tipsandtricks"]
}
}, {
"term": {
"author": 12345
}
}, {
"bool": {
"should": [{
"term": {
"public": true
}
}, {
"term": {
"author": 12345
}
}]
}
}, {
"terms": {
"lang": ["it"]
}
}]
}
}
}
},
"size": 15,
"from": 0,
"sort": {
"lastupdate": {
"order": "desc"
}
}
}
}
Always rise this exception:
[match_all] query malformed, no start_object after query name
I tried to remove "bool" under "filter", but nothing change.
I use ElastSearch PHP Client.
Someone can help me?