2

I'm using the elastic4s client for my scala elastic search and trying to search on multiple fields something like:

"query": { "match": { "_all": { "query": "SomeTermToMatch", "operator": "and" } } }

I've tried:

query { '_all', query(searchString)).operator(MatchQueryBuilder.Operator.AND) }

But it didn't return the desired result as native es does.

Does someone know how can I achive that?

griffon vulture
  • 6,594
  • 6
  • 36
  • 57

1 Answers1

1

You can form this query as:

search in "index" / "type" query {
  matchQuery("_all", "search string").operator(MatchQueryBuilder.Operator.AND)
}

You can see a unit test in the elastic4s source that shows this working.

sksamuel
  • 16,154
  • 8
  • 60
  • 108