Set operator for analyzed tokens

Is there a way to set the operators for tokens generated through the analyzer?

I have a analyzer that uses a capture group tokenizer to break up tokens by camel case e.g. "SomeTest" => ["Some", "Test"].

This works great for indexing, but when I go to search I want to only include fields that have all of the generated tokens (AND), but I get hits for anything that has at least one of the tokens (OR).

Is there any way to change this behavior? I could parse my tokens and create a more complex ES query, but I also want to do phrase queries and I believe this approach will also require me building my own span queries.

Was able to answer my own question. I was using a pattern token filter to create tokens, but these generated tokens are in the same position (not mentioned in older documentation). ES treats these as synonyms and there's nothing you can do to change the underlying bool query constructed. I've opted to replace my current tokenizer (standard) with a custom pattern tokenizer so each token get's its own position and hence won't be synonyms.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.