简体   繁体   中英

Elasticsearch Java API - fuzzy search with max_expansion

How can I translate the "more complex" fuzzy example from the QueryDSL guide into Java?

What I have so far is this: (Which works fine, but for example I'm unable to find the builder methods for "max_expansion", which would allow me to restrict the query)

QueryBuilders.fuzzyQuery("name", "kimchy")

Any pointers into the right direction are appreciated.

It supposed to be QueryBuilders.fuzzyQuery("name", "kimchy").maxExpansion(5) . But, unfortunately, the maxExpansion() method is currently missing. So, until this pull request is merged, the only way to send this query is by expressing it directly in json. You can do it using XContentBuilder.

直接构造Lucene FuzzyQuery ,然后您可以将该选项传递给构造函数arg。

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