Package org.elasticsearch.client
Class GetAliasesResponse
- java.lang.Object
-
- org.elasticsearch.transport.TransportMessage
-
- org.elasticsearch.transport.TransportResponse
-
- org.elasticsearch.action.ActionResponse
-
- org.elasticsearch.client.GetAliasesResponse
-
- All Implemented Interfaces:
Streamable
,Writeable
,StatusToXContentObject
,ToXContent
,ToXContentObject
public class GetAliasesResponse extends ActionResponse implements StatusToXContentObject
Response obtained from the get aliases API. The format is pretty horrible as it holds aliases, but at the same time errors can come back through the status and error fields. Such errors are mostly 404 - NOT FOUND for aliases that were specified but not found. In such case the client won't throw exception so it allows to retrieve the returned aliases, while at the same time checking if errors were returned. There's also the case where an exception is returned, like for instance anIndexNotFoundException
. We would usually throw such exception, but we configure the client to not throw for 404 to support the case above, hence we also not throw in case an index is not found, although it is a hard error that doesn't come back with aliases.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportResponse
TransportResponse.Empty
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V extends java.lang.Object>, Writeable.Writer<V extends java.lang.Object>
-
-
Field Summary
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Method Summary
Modifier and Type Method Description static GetAliasesResponse
fromXContent(XContentParser parser)
Parse the get aliases responsejava.util.Map<java.lang.String,java.util.Set<AliasMetaData>>
getAliases()
Return the requested aliasesjava.lang.String
getError()
Return the possibly returned error, null otherwiseElasticsearchException
getException()
Return the exception that may have been returnedRestStatus
status()
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
-
Methods inherited from class org.elasticsearch.action.ActionResponse
readFrom, writeTo
-
Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Method Detail
-
status
public RestStatus status()
- Specified by:
status
in interfaceStatusToXContentObject
-
getError
public java.lang.String getError()
Return the possibly returned error, null otherwise
-
getException
public ElasticsearchException getException()
Return the exception that may have been returned
-
getAliases
public java.util.Map<java.lang.String,java.util.Set<AliasMetaData>> getAliases()
Return the requested aliases
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
fromXContent
public static GetAliasesResponse fromXContent(XContentParser parser) throws java.io.IOException
Parse the get aliases response- Throws:
java.io.IOException
-
-