GET INDEX/_search
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "categories",
"query": {
"terms": {
"categories.id": [
9
]
}
}
}
},
{
"terms": {
"deleted": [
false
]
}
},
{
"terms": {
"published": [
true
]
}
}
],
"should": [
{
"nested": {
"path": "manufacturers",
"query": {
"terms": {
"manufacturers.id": [
2452
]
}
}
}
},
{
"bool": {
"must_not": [
{
"exists": {
"field": "manufacturers"
}
}
]
}
},
{
"nested": {
"path": "vendors",
"query": {
"terms": {
"vendors.id": [
8,9
]
}
}
}
},
{
"bool": {
"must_not": [
{
"exists": {
"field": "vendors"
}
}
]
}
}
]
}
},
"_source": {
"includes": [
"vendors.id",
"manufacturers.id",
"id"
]
}
}
So what i am trying to do... My query logic in should query is simple... manufacturerIds in values OR manufacturersIds not exist Or vendorIds in values OR vendorIds not exist , but what i want to do will look something like this: manufacturerIds in values OR manufacturersIds not exist AND vendorIds in values OR vendorIds not exist