summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/search/suggest/completion
diff options
context:
space:
mode:
authorTanguy Leroux <tlrx.dev@gmail.com>2017-02-10 10:53:38 +0100
committerGitHub <noreply@github.com>2017-02-10 10:53:38 +0100
commite2e593745546083a31ccfb9744be6174dd312858 (patch)
treeb46fe6e2dfc10e03797cdb3aea88f08c22350c6a /core/src/main/java/org/elasticsearch/search/suggest/completion
parent63ea6f7168326d1687705c87671857d29cb9a783 (diff)
Use `typed_keys` parameter to prefix suggester names by type in search responses (#23080)
This pull request reuses the typed_keys parameter added in #22965, but this time it applies it to suggesters. When set to true, the suggester names in the search response will be prefixed with a prefix that reflects their type.
Diffstat (limited to 'core/src/main/java/org/elasticsearch/search/suggest/completion')
-rw-r--r--core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestion.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestion.java b/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestion.java
index 1d8da83271..e33e421f77 100644
--- a/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestion.java
+++ b/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestion.java
@@ -57,6 +57,8 @@ import static org.elasticsearch.search.suggest.Suggest.COMPARATOR;
*/
public final class CompletionSuggestion extends Suggest.Suggestion<CompletionSuggestion.Entry> {
+ private static final String NAME = "completion";
+
public static final int TYPE = 4;
public CompletionSuggestion() {
@@ -165,11 +167,16 @@ public final class CompletionSuggestion extends Suggest.Suggestion<CompletionSug
}
@Override
- public int getType() {
+ public int getWriteableType() {
return TYPE;
}
@Override
+ protected String getType() {
+ return NAME;
+ }
+
+ @Override
protected Entry newEntry() {
return new Entry();
}