Hi,
I have 2 indexes (Item and Product).
I'm trying to get all records from Product index and records from Item index (filtered by memberID).
But my query is not working. played with different boost values but no luck.
If I apply only 1 filter then it gets the data but not both(must_not, should) at the same time.
Basically I'm looking for an "or" operator between must_not and should.
I'm upgrading 2.x to 6.x. and I ran into this issue.
Any help is highly appreciated.
Below are the details:
Item Map:
{
"properties": {
"mbr_id": {
"type": "long"
},
"item_id": {
"type": "long"
},
"item_desc": {
"analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer",
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"prdct_id": {
"type": "long"
},
"prdct_desc": {
"analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer",
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
Product Map:
{
"properties": {
"prdct_id": {
"type": "long"
},
"prdct_desc": {
"analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer",
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"index": "true"
}
}
}
}
}
Query:
GET search-product, search-item/_search
{
"size": 0,
"query": {
"bool": {
"filter": [
{
"bool": {
"must_not": {
"exists": {
"field": "mbr_id",
"boost": 10
}
},
"should": [
{
"terms": {
"mbr_id": [
"1258"
],
"boost": 1
}
}
],
"adjust_pure_negative": true,
"minimum_should_match": "1",
"boost": 1
}
}
]
}
}
}