Problem: I've implemented a partial search on a name field by indexing the tokenized name (name
field) as well as a trigram analyzed name (ngram
field).
I've boosted the name
field to have exact token matches bubble up to the top of the results.
all code references in GISTs since pre-formatted text doesn't display well
GIST: Index settings and mapping
I am trying to implement a query that limits the nGram matches to ones that only match some threshold (say 80%) of the query string. I understand that minimum_must_match
seems to be what I am looking for, but my problem is forming the query to actually produce those results.
I tried a multi-match query, which gives me correct search results, but I haven't had luck omitting results for names that only match a single trigram (say "odo" trigram inside "the odo philus")
I've tried playing around in sense, to manually produce the match queries that this produces to allow me to only apply minimum_must_match
to the ngram
field but can't seem to get the syntax right.
Can anyone see what I'm doing wrong?
It seems like this should be fairly straightforward to accomplish, but I must be missing something obvious.