Prefix query exact match

Hi,

i have text fields like above
elastic|b|c
elastic,search|b|c
elastic,search,prefix|b|c

I want to query on this string with prefix. And the query is

aggs":{"field":{"filter":{"match":{"field":{"type":"prefix","query":"elastic|"}}}
,"aggs":{"field":{"terms":{"field":"textField","size":255}}}}}},"

and this query return all texts below in the example.
Do i need extra analyzer or token filter on texts?
How can i exact match search with prefix on elastic ?

Are the fields you posted exactly like that, ie a keyword?

Fields actually analyzed list of a string that has a analyzer with "+" sign "elastic|b|c+elastic,search|b|c+elastic,search,prefix|b|c"

Indeed, now i got it that prefix query does not support an analyzed string, but i need to analyze the text and query on it like "Contains" or "IndexOf" methods. Actually i'm trying to get the text which is contains "elastic|" . And i need any suggestion faster than regex query by the way

I have two options actually :

  1. A Nested list string with no analyzer and prefix search on it ;
    {
    elastic|b|c
    elastic,search|b|c
    elastic,search,prefix|b|c
    }
  2. A regex query (no wildcard included) on analyzed string

Which is the best for my case ?

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