I'm trying to write an elasticsearch (v5.1) query to check whether all tokens in a field match all tokens in a search term, but in any order.
For example the field could be:
full_name: 'Will Smith'
And the search terms Will Smith
or Smith Will
would match. However searching Will
or Smith
would not match.
I've tried match queries with the and
operator and phrase queries with slop
, but these all ensured that the terms search were all in the field, not that all terms in the field were in the search.
I could index with a new field like reversed_name
but was wondering if there was a query option I was missing somewhere.