Let's say I have this query that applies over multiple indexes:
POST index1,index2/_search
{
"query": {
"bool": {
"filter": [
{
"term": {
"company": {
"value": "ORGUNITID",
"boost": 1
}
}
}
],
"should": [
{
"match_phrase_prefix": {
"name": {
"query": "es"
}
}
},
{
"match_phrase_prefix": {
"synonyms": {
"query": "es"
}
}
}
],
"adjust_pure_negative": true,
"minimum_should_match": "1",
"boost": 1
}
}
}
Now I wish to add 2 things:
Can I do that ?
For the thing number 1, you can add additional term searches for the _index
field. I don't understand what you want for 2, please clarify your question.
POST index1,index2/_search
{
"query": {
"bool": {
"filter": [
{
"term": {
"company": {
"value": "MT-COMPANY-FRANCE-ORGUNITID",
"boost": 1
}
}
}
],
"should": [
{
"bool": {
"must": [
{
"term": {
"_index": {
"value": "index1"
}
}
},
{
"match_phrase_prefix": {
"name": {
"query": "es"
}
}
}
]
}
},
{
"bool": {
"must": [
{
"term": {
"_index": {
"value": "index2"
}
}
},
{
"match_phrase_prefix": {
"synonyms": {
"query": "es"
}
}
}
]
}
}
],
"adjust_pure_negative": true,
"minimum_should_match": "1",
"boost": 1
}
}
}