I have created my indexes, and the mapping type for the suggest field is set to complete. I can't figure out how to set up a query for termination suggestions in elastic search (Java API)
I am trying to use this query to execute my implementation.
"song-suggest" : {
"text" : "n",
"completion" : {
"field" : "suggest"
}
}
That's what I still have
CompletionSuggestionBuilder compBuilder = new CompletionSuggestionBuilder("complete");
compBuilder.text("n");
compBuilder.field("suggest");
SearchResponse searchResponse = localClient.prepareSearch(INDEX_NAME)
.setTypes("completion")
.setQuery(QueryBuilders.matchAllQuery())
.addSuggestion(compBuilder)
.execute().actionGet();
CompletionSuggestion compSuggestion = searchResponse.getSuggest().getSuggestion("complete");
Am I missing something, is something wrong? Thank!
source
share