Hi all. Please tell me, I have a request like this (request 1) and if field2 in it is empty, then I want to exclude it from the selection so that a request like this will be executed (request 2). How can I do this?
Request 1:
{
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{ "match": { "full": "test1 test2 test3" }}
]
}
},
{
"bool": {
"must": [
{ "match": { "field1": "test1" }},
{ "match": { "field2": "test2" }},
{ "match": { "field3": "test3" }}
]
}
}
]
}
}
}
Request 2:
{
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{ "match": { "full": "test test" }}
]
}
},
{
"bool": {
"must": [
{ "match": { "field1": "test1" }},
//{ "match": { "field2": "" }},
{ "match": { "field3": "test3" }}
]
}
}
]
}
}
}
I'm asking this because I can't delete this field programmatically.