I am trying to use utilize a phrase search on an ngrammed field to do autocomplete over the titles in my documents.
Since the phrase search has no preference to the position in the title that a phrase is matched and I want the search to prefer matches in the begining of the title, I thought I could solve that by having a tokenfilter add a certain "[#START#]" token as the first token during indexing, and then, in my phrase search, include that "[#START#]" in the beginning as part of the phrase search as well. That would force it to match only documents with that phrase in the beginning of the title.
I would of course have another phrase search to allow other matches, later in the string, but with a lower score.
Does that sound silly? and if not, how would I go about adding that static token without having to have it in my source? I would prefer not having to do it in Java, as that would add another dependency to keep track of when updating between ES versions. We're currently on 1.4.5 and we do have plans of upgrading to 5.x ASAP.