"Starts With" and Synonyms


I am currently working on a "starts with" (mutiple words) functionnality on
an existing index which analysis is amongst other things based on synonym
token filter.

Since reindexing is not a problem, my first attempt was to use a approach
based on a keyword tokenizer. It did the trick, except that synonym token
filter did not apply (which I understand).

So I had a second attempt using match phrase. Synonym part was correct,
words order was correct but I did not have the "starts with" anymore.

I am thinking of handling synonym part before indexing, which would be find
for me but I wonder if there is any better way to do this with ES.

Is there anyway to add a "position" constraint on my search query?
Did I miss something?

An example of what I am expecting to make this clearer
Let's say I have 3 values in my index and k is a synonym for *bb *:

  1. "aa bb cc"
  2. "aa bb dd"
  3. "dd aa bb"

searching "aa bb" returns 1 & 2
searching "aa k" returns 1 & 2


You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/59f57c4e-e060-49da-8e2e-6e24b888cbe0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.