Prefix Queries Using NEST API

Is there any way to analyze the prefix text as the same analyzer used in the indexing.
For example :

var searchResponse = await client.SearchAsync<Locality>(s => s.Index($"localities-{country.ToLower()}")
               .Query(q => q
                .Prefix(c => c
                .Name("named_query")
                .Boost(1.1)
                .Field(p => p.Name)
                .Value(locality.ToLower())
                .Rewrite(MultiTermQueryRewrite.TopTerms(10))
                    )

               )
            );

We keep having to use the ToLower() function to lowecase everything which is not ideal as the analysis in the index may be different.

Giving the note Term-level queries | Elasticsearch Guide [8.2] | Elastic It's might be possible with match_bool_prefix or via tweaking normalizer for named_query if it's a keyword field.

Hi,
Thanks for your reply.
Yes it is possible but we also need to include a filter in the query which none of the available options seem to allow it.

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