标签:
1 SpanNearQueryBuilder span = QueryBuilders.spanNearQuery(); 2 span.clause(QueryBuilders.spanTermQuery("Text", "学")); 3 span.clause(QueryBuilders.spanTermQuery("Text", "联")); 4 span.inOrder(true).slop(1); 5 SearchRequestBuilder rs = client.prepareSearch("weiboall") 6 .setQuery(span).setFrom(0).setSize(20); 7 SearchResponse response = rs.get();
1 { 2 "from": 0, 3 "size": 20, 4 "query": { 5 "span_near": { 6 "clauses": [ 7 { 8 "span_term": { 9 "Text": { 10 "value": "在" 11 } 12 } 13 }, 14 { 15 "span_term": { 16 "Text": { 17 "value": "讨" 18 } 19 } 20 } 21 ], 22 "slop": 0, 23 "in_order": true 24 } 25 } 26 }
标签:
原文地址:http://www.cnblogs.com/tianjixiaoying/p/4316071.html