-
-
Save anonymous/509b3db873a30d8961ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPOST http://hostname:8080/index0/item/_search?routing=0_${catId}&_source=false | |
{"size": 20,"query": { | |
"filtered": { | |
"query": { "match": { "title": { | |
"query": "${title}", | |
"type": "boolean", | |
"minimum_should_match": "60%"}}}, | |
"filter": {"bool": {"must": {"term": {"category": "${catId}"} | |
}}}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BoolFilterBuilder filter = FilterBuilders.boolFilter().must(FilterBuilders.termFilter("category", cat)); | |
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder() | |
.size(20) | |
.fetchSource(false) | |
.query(QueryBuilders.filteredQuery( | |
QueryBuilders.matchQuery("title", query) | |
.minimumShouldMatch("60%"), filter)); | |
SearchRequest srb = new SearchRequest() | |
.indices("index0") | |
.types("item") | |
.source(sourceBuilder) | |
.routing("0_" + cat); | |
SearchResponse resp = esClient.execute(SearchAction.INSTANCE, srb).actionGet(); |
jprante
commented
Dec 18, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment