简体   繁体   中英

Elasticsearch/Nest - using MultiMatch TextQueryType.Phrase and wildcard

In relation to the question: Elasticsearch/Nest - using MatchPhrase with OnFieldsWithBoost

I would like to know if it is possible to extend the solution from that question to make elasticsearch search for everything matching "The sun is shin" and get results like "The sun is shining". I was thinking something like search query "The sun is shin*" but that does not seem to work.

Use another TextQueryType value : PhrasePrefix .

Your multi-match query will be of type phrase_prefix, and ElasticSearch will search for indexed terms starting with the last term of your query phrase (more information here about match_phrase_prefix in the documentation).

However, the multi-match query doesn't support wildcards characters (mentioned in the question's title) like * and ? .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM