Merge pull request #15692 from s1monw/issues/15675
Fix pharse suggest collate example to use correct script context/syntax
This commit is contained in:
commit
ea2a8150d3
|
@ -192,8 +192,10 @@ curl -XPOST 'localhost:9200/_search' -d {
|
|||
} ],
|
||||
"collate": {
|
||||
"query": { <1>
|
||||
"match": {
|
||||
"{{field_name}}" : "{{suggestion}}" <2>
|
||||
"inline" : {
|
||||
"match": {
|
||||
"{{field_name}}" : "{{suggestion}}" <2>
|
||||
}
|
||||
}
|
||||
},
|
||||
"params": {"field_name" : "title"}, <3>
|
||||
|
|
|
@ -82,12 +82,12 @@ import static org.hamcrest.Matchers.nullValue;
|
|||
* request, modify again, request again, etc. This makes it very obvious what changes between requests.
|
||||
*/
|
||||
public class SuggestSearchTests extends ESIntegTestCase {
|
||||
|
||||
|
||||
@Override
|
||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
||||
return Collections.singleton(MustachePlugin.class);
|
||||
}
|
||||
|
||||
|
||||
// see #3196
|
||||
public void testSuggestAcrossMultipleIndices() throws IOException {
|
||||
createIndex("test");
|
||||
|
@ -612,7 +612,7 @@ public class SuggestSearchTests extends ESIntegTestCase {
|
|||
// Check the name this time because we're repeating it which is funky
|
||||
assertThat(searchSuggest.getSuggestion("simple_phrase").getEntries().get(0).getText().string(), equalTo("Xor the Got-Jewel Xor the Got-Jewel Xor the Got-Jewel"));
|
||||
}
|
||||
|
||||
|
||||
private List<String> readMarvelHeroNames() throws IOException, URISyntaxException {
|
||||
return Files.readAllLines(PathUtils.get(Suggest.class.getResource("/config/names.txt").toURI()), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
@ -1150,11 +1150,12 @@ public class SuggestSearchTests extends ESIntegTestCase {
|
|||
String filterString = XContentFactory.jsonBuilder()
|
||||
.startObject()
|
||||
.startObject("match_phrase")
|
||||
.field("title", "{{suggestion}}")
|
||||
.field("{{field}}", "{{suggestion}}")
|
||||
.endObject()
|
||||
.endObject()
|
||||
.string();
|
||||
PhraseSuggestionBuilder filteredQuerySuggest = suggest.collateQuery(filterString);
|
||||
filteredQuerySuggest.collateParams(Collections.singletonMap("field", "title"));
|
||||
searchSuggest = searchSuggest("united states house of representatives elections in washington 2006", filteredQuerySuggest);
|
||||
assertSuggestionSize(searchSuggest, 0, 2, "title");
|
||||
|
||||
|
|
Loading…
Reference in New Issue