我刚打酱油去了,不好意思

elasticsearch7.9.3 java高级客户端 查询 中文转义问题造成无法查询到结果

Elasticsearch | 作者 huanghui | 发布于2020年12月03日 | 阅读数:3613

这是代码
SearchRequest request = new SearchRequest("goodsinfo");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
CompletionSuggestionBuilder completionSuggestionBuilder = new CompletionSuggestionBuilder("commodity_name");
completionSuggestionBuilder.prefix(text).size(10).skipDuplicates(true).analyzer("ik_smart");
SuggestBuilder suggestBuilder = new SuggestBuilder();
suggestBuilder.addSuggestion("suggest_keyword", completionSuggestionBuilder);
searchSourceBuilder.suggest(suggestBuilder);
request.source(searchSourceBuilder);
return client.search(request, RequestOptions.DEFAULT);
这是debugger日志
 
{"suggest":{"suggest_keyword":{"prefix":"[0xffffffe5][0xffffffb0][0xffffff9a]","completion":{"analyzer":"ik_smart","field":"commodity_name","size":10,"skip_duplicates":true}}}}

 
已邀请:

要回复问题请先登录注册