Package org.opensearch.data.client.orhlc
Class DocumentAdapters
java.lang.Object
org.opensearch.data.client.orhlc.DocumentAdapters
Utility class to adapt
GetResponse,
GetResult, MultiGetResponse
SearchHit, DocumentField to
Document.- Since:
- 0.1
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.data.elasticsearch.core.document.Documentfrom(org.opensearch.action.get.GetResponse getResponse) Create aDocumentfromGetResponse.static org.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document>from(org.opensearch.action.get.MultiGetItemResponse itemResponse) Creates aorg.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document>from aMultiGetItemResponse.static List<org.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document>>from(org.opensearch.action.get.MultiGetResponse source) Creates a List oforg.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document>s fromMultiGetResponse.static org.springframework.data.elasticsearch.core.document.Documentfrom(org.opensearch.index.get.GetResult source) Create aDocumentfromGetResult.static org.springframework.data.elasticsearch.core.document.SearchDocumentfrom(org.opensearch.search.SearchHit source) Create aSearchDocumentfromSearchHit.static org.springframework.data.elasticsearch.core.document.DocumentfromDocumentFields(Iterable<org.opensearch.common.document.DocumentField> documentFields, String index, String id, long version, long seqNo, long primaryTerm)
-
Method Details
-
from
@Nullable public static org.springframework.data.elasticsearch.core.document.Document from(org.opensearch.action.get.GetResponse getResponse) Create aDocumentfromGetResponse.Returns a
Documentusing the getResponse if available.- Parameters:
getResponse- the getResponseGetResponse.- Returns:
- the adapted
Document, null if getResponse.isExists() returns false.
-
from
@Nullable public static org.springframework.data.elasticsearch.core.document.Document from(org.opensearch.index.get.GetResult source) Create aDocumentfromGetResult.Returns a
Documentusing the source if available.- Parameters:
source- the sourceGetResult.- Returns:
- the adapted
Document, null if source.isExists() returns false.
-
from
public static List<org.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document>> from(org.opensearch.action.get.MultiGetResponse source) Creates a List oforg.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document>s fromMultiGetResponse.- Parameters:
source- the sourceMultiGetResponse, not null.- Returns:
- a list of Documents, contains null values for not found Documents.
-
from
public static org.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document> from(org.opensearch.action.get.MultiGetItemResponse itemResponse) Creates aorg.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document>from aMultiGetItemResponse.- Parameters:
itemResponse- the response, must not be null- Returns:
- the MultiGetItem
-
from
public static org.springframework.data.elasticsearch.core.document.SearchDocument from(org.opensearch.search.SearchHit source) Create aSearchDocumentfromSearchHit.Returns a
SearchDocumentusing the source if available.- Parameters:
source- the sourceSearchHit.- Returns:
- the adapted
SearchDocument.
-
fromDocumentFields
public static org.springframework.data.elasticsearch.core.document.Document fromDocumentFields(Iterable<org.opensearch.common.document.DocumentField> documentFields, String index, String id, long version, long seqNo, long primaryTerm) - Parameters:
documentFields- theDocumentFields backing theDocument.index- the index where the Document was foundid- the document idversion- the document versionseqNo- the seqNo if the documentprimaryTerm- the primaryTerm of the document- Returns:
- the adapted
Document.
-