Fix pharse suggest collate example to use correct script context/syntax
Closes #15675
This commit is contained in:
parent
387bdbd322
commit
3b06cd8d92
|
@ -192,9 +192,11 @@ curl -XPOST 'localhost:9200/_search' -d {
|
||||||
} ],
|
} ],
|
||||||
"collate": {
|
"collate": {
|
||||||
"query": { <1>
|
"query": { <1>
|
||||||
|
"inline" : {
|
||||||
"match": {
|
"match": {
|
||||||
"{{field_name}}" : "{{suggestion}}" <2>
|
"{{field_name}}" : "{{suggestion}}" <2>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"params": {"field_name" : "title"}, <3>
|
"params": {"field_name" : "title"}, <3>
|
||||||
"prune": true <4>
|
"prune": true <4>
|
||||||
|
|
|
@ -1166,11 +1166,12 @@ public class SuggestSearchTests extends ESIntegTestCase {
|
||||||
String filterString = XContentFactory.jsonBuilder()
|
String filterString = XContentFactory.jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.startObject("match_phrase")
|
.startObject("match_phrase")
|
||||||
.field("title", "{{suggestion}}")
|
.field("{{field}}", "{{suggestion}}")
|
||||||
.endObject()
|
.endObject()
|
||||||
.endObject()
|
.endObject()
|
||||||
.string();
|
.string();
|
||||||
PhraseSuggestionBuilder filteredQuerySuggest = suggest.collateQuery(filterString);
|
PhraseSuggestionBuilder filteredQuerySuggest = suggest.collateQuery(filterString);
|
||||||
|
filteredQuerySuggest.collateParams(Collections.singletonMap("field", "title"));
|
||||||
searchSuggest = searchSuggest("united states house of representatives elections in washington 2006", filteredQuerySuggest);
|
searchSuggest = searchSuggest("united states house of representatives elections in washington 2006", filteredQuerySuggest);
|
||||||
assertSuggestionSize(searchSuggest, 0, 2, "title");
|
assertSuggestionSize(searchSuggest, 0, 2, "title");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue