Class DocumentAdapters

java.lang.Object
org.opensearch.data.client.orhlc.DocumentAdapters

public final class DocumentAdapters extends Object
Utility class to adapt GetResponse, GetResult, MultiGetResponse SearchHit, DocumentField to Document.
Since:
0.1
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.springframework.data.elasticsearch.core.document.Document
    from(org.opensearch.action.get.GetResponse getResponse)
    Create a Document from GetResponse.
    static org.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document>
    from(org.opensearch.action.get.MultiGetItemResponse itemResponse)
    Creates a org.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document> from a MultiGetItemResponse.
    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 of org.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document>s from MultiGetResponse.
    static org.springframework.data.elasticsearch.core.document.Document
    from(org.opensearch.index.get.GetResult source)
    Create a Document from GetResult.
    static org.springframework.data.elasticsearch.core.document.SearchDocument
    from(org.opensearch.search.SearchHit source)
    Create a SearchDocument from SearchHit.
    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)
    Create an unmodifiable Document from Iterable of DocumentFields.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • from

      @Nullable public static org.springframework.data.elasticsearch.core.document.Document from(org.opensearch.action.get.GetResponse getResponse)
      Create a Document from GetResponse.

      Returns a Document using the getResponse if available.

      Parameters:
      getResponse - the getResponse GetResponse.
      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 a Document from GetResult.

      Returns a Document using the source if available.

      Parameters:
      source - the source GetResult.
      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 of org.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document>s from MultiGetResponse.
      Parameters:
      source - the source MultiGetResponse, 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 a org.springframework.data.elasticsearch.core.MultiGetItem<org.springframework.data.elasticsearch.core.document.Document> from a MultiGetItemResponse.
      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 a SearchDocument from SearchHit.

      Returns a SearchDocument using the source if available.

      Parameters:
      source - the source SearchHit.
      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)
      Create an unmodifiable Document from Iterable of DocumentFields.
      Parameters:
      documentFields - the DocumentFields backing the Document.
      index - the index where the Document was found
      id - the document id
      version - the document version
      seqNo - the seqNo if the document
      primaryTerm - the primaryTerm of the document
      Returns:
      the adapted Document.