Compounding a phrase and prefix

Is it possible to compound phrase and prefix?

The user types in ‘Spring Mea’

Matching everything that has ‘Spring Mea’ in it like
‘Spring Meadows’
‘High Spring Meals'

vs.

just search for results that match directly ‘Spring Mea’

Vibrant community!

Your bump actually worked!

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html

There are some caveats to how phrase prefix works in that it might not find all the results (max_expansions). Thus, the big block of text about autocomplete.

1 Like

:raised_hands:

Any way to achieve full-text phrase and prefix with version 2.3? (current AWS service level)?

What parser does ES recommend?

In 2.3 you use a match query with type phrase_prefix:
https://www.elastic.co/guide/en/elasticsearch/reference/2.3/query-dsl-match-query.html

What do you mean by "parser"? Do you mean analzyer? if so then usually you use the same one that you used when indexing. The default analyzer is pretty good. You can experiment with things like a custom analyzer with kstem or some other token filter to get different stemming. This contains a reference for how you'd build the built in analyzers which should give you a place to start customizing from.

By parser I mean the difference between lucene and dismax

Do you have a link to the docs for the setting you are talking about?

Hi! No documentation. Our mobile app devs have only worked with "parsers" in the past for other search methods, but never ES. I think they are assuming ES must work with a parsers as well. Truthfully I don't think we understand the architecture. Anything you can offer to set us strait would be golden.

So dismax describes how you merge the weight from many fields so it more applies to the multi_match query. Here is what to read for that:
https://www.elastic.co/guide/en/elasticsearch/reference/2.3/query-dsl-multi-match-query.html

It is worth experimenting with, but if you need phrase prefix behavior you don't really have a choice. If you don't need the phrase prefix then cross_fields often gives the best results.

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