Anurag Tripathi
Anurag Tripathi

Reputation: 11

Is there anyway to create alias on query search?

I want to create an alias on top of this. Index - test, Type - type

POST /test/type/_search
{
    "query": {
    "match": {
        "brand_name": "xyz"
        }
   }    
}

But I don't see anyway of doing it,since Elasticsearch aliases can only be created on filters and when I try with term filter,I don't get the results which I want.Any trick to achieve this ?

Upvotes: 0

Views: 132

Answers (1)

ejain
ejain

Reputation: 3614

You can use a query filter to use any query as a filter:

"filter" : {
  "query" : {
    "match" : {
      "brand_name" : "xyz"
    }
  }
}

Upvotes: 1

Related Questions