Class CompletionSuggestion
java.lang.Object
org.elasticsearch.search.suggest.Suggest.Suggestion<CompletionSuggestion.Entry>
org.elasticsearch.search.suggest.completion.CompletionSuggestion
- All Implemented Interfaces:
java.lang.Iterable<CompletionSuggestion.Entry>,NamedWriteable,Writeable,ToXContent,ToXContentFragment
public final class CompletionSuggestion extends Suggest.Suggestion<CompletionSuggestion.Entry>
Suggestion response for
CompletionSuggester results
Response format for each entry:
{
"text" : STRING
"score" : FLOAT
"contexts" : CONTEXTS
}
CONTEXTS : {
"CONTEXT_NAME" : ARRAY,
..
}-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCompletionSuggestion.EntryNested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields Modifier and Type Field Description static intTYPEDeprecated. -
Constructor Summary
Constructors Constructor Description CompletionSuggestion(java.lang.String name, int size, boolean skipDuplicates)Creates a completion suggestion given its name, size and whether it should skip duplicatesCompletionSuggestion(StreamInput in) -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object other)static CompletionSuggestionfromXContent(XContentParser parser, java.lang.String name)java.util.List<CompletionSuggestion.Entry.Option>getOptions()java.lang.StringgetWriteableName()Returns the name of the writeable objectintgetWriteableType()Returns a integer representing the type of the suggestion.inthashCode()booleanhasScoreDocs()protected CompletionSuggestion.EntrynewEntry(StreamInput in)CompletionSuggestionreduce(java.util.List<Suggest.Suggestion<CompletionSuggestion.Entry>> toReduce)Merges the result of another suggestion into this suggestion.voidsetShardIndex(int shardIndex)voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class org.elasticsearch.search.suggest.Suggest.Suggestion
addTerm, fromXContent, getEntries, getName, getSize, iterator, parseEntries, sortComparator, toXContent, trim
-
Field Details
-
TYPE
@Deprecated public static final int TYPEDeprecated.- See Also:
- Constant Field Values
-
-
Constructor Details
-
CompletionSuggestion
public CompletionSuggestion(java.lang.String name, int size, boolean skipDuplicates)Creates a completion suggestion given its name, size and whether it should skip duplicates- Parameters:
name- The name for the suggestionssize- The number of suggestions to returnskipDuplicates- Whether duplicate suggestions should be filtered out
-
CompletionSuggestion
- Throws:
java.io.IOException
-
-
Method Details
-
getWriteableName
public java.lang.String getWriteableName()Description copied from interface:NamedWriteableReturns the name of the writeable object- Specified by:
getWriteableNamein interfaceNamedWriteable- Specified by:
getWriteableNamein classSuggest.Suggestion<CompletionSuggestion.Entry>
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classSuggest.Suggestion<CompletionSuggestion.Entry>- Throws:
java.io.IOException
-
getOptions
- Returns:
- the result options for the suggestion
-
hasScoreDocs
public boolean hasScoreDocs()- Returns:
- whether there is any hits for the suggestion
-
equals
public boolean equals(java.lang.Object other)- Overrides:
equalsin classSuggest.Suggestion<CompletionSuggestion.Entry>
-
hashCode
public int hashCode()- Overrides:
hashCodein classSuggest.Suggestion<CompletionSuggestion.Entry>
-
fromXContent
public static CompletionSuggestion fromXContent(XContentParser parser, java.lang.String name) throws java.io.IOException- Throws:
java.io.IOException
-
reduce
public CompletionSuggestion reduce(java.util.List<Suggest.Suggestion<CompletionSuggestion.Entry>> toReduce)Description copied from class:Suggest.SuggestionMerges the result of another suggestion into this suggestion. For internal usage.- Overrides:
reducein classSuggest.Suggestion<CompletionSuggestion.Entry>
-
setShardIndex
public void setShardIndex(int shardIndex) -
getWriteableType
public int getWriteableType()Description copied from class:Suggest.SuggestionReturns a integer representing the type of the suggestion. This is used for internal serialization over the network. This class is now serialized as a NamedWriteable and this method only remains for backwards compatibility- Overrides:
getWriteableTypein classSuggest.Suggestion<CompletionSuggestion.Entry>
-
newEntry
- Specified by:
newEntryin classSuggest.Suggestion<CompletionSuggestion.Entry>- Throws:
java.io.IOException
-