我第一次使用Elasticsearch,我确信这一定很容易,但是到目前为止,我还没有使用Java的解决方案:
我有一系列的搜索词,我想以一种不区分大小写的方式返回匹配这些词的点击。
除了区分大小写外,这段代码可以工作,但我希望它不区分大小写:
String[] terms = {"orange", "peach"};
SearchResponse response = client.prepareSearch("orders")
.setTypes("fruit")
.setQuery(
QueryBuilders.termsQuery("description", terms).minimumMatch(1)
)
.setFrom(0).setSize(10)
.setExplain(true)
.execute()
.actionGet();
for ( SearchHit hit : response.getHits()) {
String source = hit.sourceAsString();
//only case sensitive matches found...
}https://stackoverflow.com/questions/26981514
复制相似问题