ElasticSearch UI: Add filters on top of the search query

Hi team,

Our team is using Elastic search UI functions including Elastic Search connector (setup like this Elasticsearch Connector | Documentation) and SearchDriver (set up like this Configuration | Documentation)
On top of search query term, the user can also add filters to filter the search results even more.

The "filters" field in searchQuery (within the SearchDriver) only matches the exact value provided instead of a "contains".

We tried the following on the Elasticsearch console and it works great!

GET /my_index/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "title": "tutorial"
          }
        },
        {
          "match": {
            "title": "install"
          }
        }
      ]
    }
  }
}

how can we replicate this exact behavior using searchDriver? Is it possible or is there another field we could use?

Thanks!!

Hiru,
Have you attempted to customize the Elasticsearch request body yet? At the bottom of the "Elastic Connector" documentation page, there's a reference for how to customize the query options.

Hi James!

That actually ended up being the fix! Thank you for the suggestion!

This is what I basically did in the code when we are creating the API connector,
I had to override query to include the following bool -> should values that contains the "filter".
This query allows us to filter on multiple filters on top of the search query.

GET /search-gitlab-docs-hugo/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "bool": {
            "should": [
              {
                "term": {
                  "gitlab_docs_section": "tutorials"
                }
              }
            ]
          }
        }
      ],
      "minimum_should_match": 1
    }
  },
  "highlight": {
    "fields": {
      "body_content": {}
    }
  }
}