I'm trying to migrate from ES 0.90 to 6.5 and I have the following query:
{
"query": {
"bool": {
"should": [
{
"multi_match": {
"query": "field Value",
"fields": "fieldName"
}
},
{
"multi_match": {
"query": "yes",
"fields": "property.ACTIVE_*"
}
},
{
"multi_match": {
"query": "true",
"fields": "property.ACTIVE_*"
}
}
]
}
},
"filter": {
"term": {
"type": "documentType"
}
}
}
How can I rewrite this in ES6.5?
I've tried something like this:
{
"query": {
"bool": {
"filter": [
{
"nested": {
"path": "properties",
"query": {
"bool": {
"should": [
{
"wildcard": {
"properties.key.keyword": "ACTIVE_*"
}
},
{
"match": {
"properties.value": "true"
}
},
{
"match": {
"properties.value": "Yes"
}
},
{
"match": {
"properties.value": "fieldValue"
}
},
{
"match": {
"properties.key": "fieldValueName"
}
}
]
}
}
}
}
]
}
}
}
But how can I link the two properties value "Yes" and "true" to be checked with the wildcard "ACTIVE_*" and the other properties.value "fieldValue" together with the remaining "fieldValueName". So if any document matches the wildcard field, which is a nested data and the same object has a value field with "Yes" or "true" to be returned. Or if the document has a nested data with "value" field of "fieldValue" and "key" field of "fieldValueName" to be returned as well. I didn't include the filter term of "documentType", but I guess I'll add this after I figure out the rest of the query.