ES 5.4 parsing exception

Hi everyone . It would be helpful if someone can help me with this

"index": "default",
"type": "user",
"from": 0,
"size": 10,
"body": {
"sort": [
{
"lastPost.created": {
"order": "desc"
}
},
{
"firstName": "desc"
},
{
"lastName": "desc"
}
],
"query": {
"bool": {
"must": [
{
"match": {
"sector._id": "56085c40d5497167554c6391"
}
}
]
},
"terms": {
"userId": [
"59d6603e068e463698eca7cf",
"58b12ef9154fd29f69b6f651"
]
}
}
}

returns an error:
[parsing_exception] [bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME], with { line=1 col=169 }

Without terms it works, but I need to see users with specific id-s

The terms query must be embedded in the bool query directly in order to indicate the type of match that this query should handle (is it an optional clause or a mandatory one). For instance if the terms query is mandatory you'll need to add an entry in the must or filter (if scores are not needed) section of the bool query.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.