[英]how to implement “suggest” query, with JavaClient in Elasticsearch
I want to execute the following query with JavaClient. 我想使用JavaClient执行以下查询。
{
"suggest": {
"my-suggestion-1": {
"text": "sample",
"completion": {
"field": "suggest1",
"size": 10
}
}
}
}
I could not find the document. 我找不到文件。
Please let me know the URL of the document. 请让我知道文件的网址。 Also, how should I implement it?
另外,我应该如何实施呢?
Someone, please lend me your wisdom. 有人,请借给我你的智慧。
Try something like 尝试类似
TermSuggestionBuilder termSuggestionBuilder = SuggestBuilders.termSuggestion("field_name").text("my suggest terms");
client.prepareSearch("my_index").setSize(0).suggest(new SuggestBuilder().addSuggestion("foo", termSuggestionBuilder)).get();
A good thing to do is usually to check the Elasticsearch tests itself, like the CompletionSuggestSearchIT 一件好事通常是检查Elasticsearch测试本身,例如CompletionSuggestSearchIT
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.