Reputation: 488
This is the dictionary pattern of elasticsearch {'id': 3},{'id': 4},{'id': 5},{'id': 6}
Below is the query to search 'Country Owner.id.keyword' and 'Territory Owner.id.keyword'
output
will contain only from 6 with value 'ABC101'
if presenta = {'from': 0, 'size': 200,'query': {
'bool': {
'should': [
{
'terms': {
'Country Owner.id.keyword': [
'ABC101'
]
}
},
{
'terms': {
'Territory Owner.id.keyword': [
'ABC101'
]
}
}
]
}
}
}
Upvotes: 0
Views: 145
Reputation: 16172
You can use a terms query inside a must_not
clause
{
"query": {
"bool": {
"should": [
{
"terms": {
"Country Owner.id.keyword": [
"ABC101"
]
}
},
{
"terms": {
"Territory Owner.id.keyword": [
"ABC101"
]
}
}
],
"must_not": {
"terms": {
"id": [
3,
4,
5
]
}
}
}
}
}
Upvotes: 1