I am trying to do the following, exclude data that matches restricted_general_calculated = "all" unless another field(s) = something
This is the must_not
{
"query": {
"bool": {
"must_not": [
{
"terms": {
"restricted_general_calculated": [
"all"
]
}
}
],
"must": []
}
}
}
I then want to use this to include records even if restricted_general_calculated="all"
{
"nested": {
"path": "salesRights",
"query": {
"nested": {
"path": "salesRights.salesRestriction",
"query": {
"bool": {
"must": [
{
"term": {
"salesRights.salesRestriction.salesRestrictionType": "04"
}
},
{
"match": {
"salesRights.salesRestriction.salesOutletName": "www.mysite.co.uk"
}
}
]
}
}
}
}
}
}
I tried various combinations but have just got myself into a muddle
Any help would be appreciated
Thanks
Grant