Query String Query boosting

Hello
I have 5 different indices on which I would like to do a full text search. The mappings of the indices are all different from another, but they all have a common field on which I can join them on the client side.

To give the question some more context: The 5 indices represent a ticketing system. The main index has all the attributes of a ticket, then there is an other index with the history entries for all tickets, another for the assigned customers, etc.
These indices all have a common field called "TicketNumber" to identify which history entries are assigned to which tickets.

I already have a query on which I can search all the indices at once, it looks like this:

GET _search
{
  "_source": "TicketNumber", 
  "query": {
    "query_string": {
      "default_field": "*",
      "query": "searchtext"
    }
  }
}

Now I would like to know if it is possible to boost certain results, like all the results from the main ticket index should have a boosted score.

You can boost results from specific indexes by adding a indices_boost clause to your search request. For example, your request could look something like this to boost the results from the my_main_index index:

GET _search
{
  "_source": "TicketNumber", 
  "query": {
    "query_string": {
      "default_field": "*",
      "query": "searchtext"
    }
  },
  "indices_boost": [
    {
      "my_main_index": 10
    }
  ]
}

Wow thanks, that is just perfectly what I needed.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.