Search in sources :

Example 1 with ID_FIELD

use of org.eclipse.jnosql.communication.elasticsearch.document.EntityConverter.ID_FIELD in project jnosql-diana-driver by eclipse.

the class ElasticsearchEntry method toEntity.

DocumentEntity toEntity() {
    Document id = Document.of(ID_FIELD, this.id);
    List<Document> documents = map.keySet().stream().map(k -> toDocument(k, map)).collect(Collectors.toList());
    DocumentEntity entity = DocumentEntity.of(collection, documents);
    entity.remove(ID_FIELD);
    entity.add(id);
    return entity;
}
Also used : SearchHit(org.elasticsearch.search.SearchHit) GetResponse(org.elasticsearch.action.get.GetResponse) ID_FIELD(org.eclipse.jnosql.communication.elasticsearch.document.EntityConverter.ID_FIELD) Document(jakarta.nosql.document.Document) DocumentEntity(jakarta.nosql.document.DocumentEntity) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) ENTITY(org.eclipse.jnosql.communication.elasticsearch.document.EntityConverter.ENTITY) StreamSupport.stream(java.util.stream.StreamSupport.stream) Map(java.util.Map) Objects.isNull(java.util.Objects.isNull) DocumentEntity(jakarta.nosql.document.DocumentEntity) Document(jakarta.nosql.document.Document)

Aggregations

Document (jakarta.nosql.document.Document)1 DocumentEntity (jakarta.nosql.document.DocumentEntity)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Objects.isNull (java.util.Objects.isNull)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 Collectors.toList (java.util.stream.Collectors.toList)1 StreamSupport.stream (java.util.stream.StreamSupport.stream)1 ENTITY (org.eclipse.jnosql.communication.elasticsearch.document.EntityConverter.ENTITY)1 ID_FIELD (org.eclipse.jnosql.communication.elasticsearch.document.EntityConverter.ID_FIELD)1 GetResponse (org.elasticsearch.action.get.GetResponse)1 SearchHit (org.elasticsearch.search.SearchHit)1