How could I search an array of terms using wildcard

I'm looking for a way to search an array of items where should have wildcards in their extremities.
I tried to use query_string, but this search does not allow an array search.

    {"query": {
            "bool": {
              "must": [
                {
                  "query_string": {
                    "query": ["*item1*","*item2*"],
                    "fields": [
                      "fiscalID"
                    ],
                    "default_operator": "OR"
                  }
                }
              ]
          }
      }
    }

If someone has any solution I will really appreciate it.
Thanks.

You do not need to provide an array of search terms. If you provide the terms in a single string, the query_string query will break it up wherever it finds an operator (in this case the wildcards). Try this:

GET my_index/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "*item1* *item2*",
            "fields": [
              "fiscalID"
            ]
          }
        }
      ]
    }
  }
}

OR is already the default operator, you can omit that.

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