如何在elasticsearch中使用fuzzyLikeThisFieldQuery突出显示结果查询?我可以接受fuzzyQuery 但不能接受fuzzyLikeThisFieldQuery。例如,在下面的代码中,我使用了模糊查询:
QueryBuilder allquery = QueryBuilders.fuzzyQuery("name", "fooobar").minSimilarity(0.4f);
SearchRequestBuilder builder = ds.getElasticClient()
.prepareSearch("data")
.setQuery(allquery)
.setFrom(0)
.setSize(10)
.setTypes("entity")
.setSearchType(SearchType.DEFAULT)
.addHighlightedField("name")
.addField("name");
SearchResponse sr = builder.execute().actionGet();
结果是
If you want to have a <em>foobar</em> for oracle
但是如果我使用fuzzyLikeThisFieldQuery,没有突出显示
QueryBuilder allquery = QueryBuilders.fuzzyLikeThisFieldQuery("name").likeText("fooobar").minSimilarity(0.4f);
结果是
If you want to have a foobar for oracle
有谁知道为什么?