Skip to content

Commit 1fcb71c

Browse files
committed
protect ES
1 parent 8677899 commit 1fcb71c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

elasticsearch-driver/src/main/java/org/jnosql/diana/elasticsearch/document/ElasticsearchEntry.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package org.jnosql.diana.elasticsearch.document;
1616

1717

18+
import org.elasticsearch.action.get.GetResponse;
1819
import org.elasticsearch.search.SearchHit;
1920
import org.jnosql.diana.api.document.Document;
2021
import org.jnosql.diana.api.document.DocumentEntity;
@@ -100,4 +101,9 @@ static ElasticsearchEntry of(SearchHit searchHit) {
100101
searchHit.getSourceAsMap());
101102
}
102103

104+
static ElasticsearchEntry of(GetResponse searchHit) {
105+
return new ElasticsearchEntry(searchHit.getId(),
106+
searchHit.getType(),
107+
searchHit.getSourceAsMap());
108+
}
103109
}

elasticsearch-driver/src/main/java/org/jnosql/diana/elasticsearch/document/EntityConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private static void executeId(DocumentQuery query, RestHighLevelClient client, S
175175
MultiGetResponse responses = client.multiGet(multiGetRequest);
176176
Stream.of(responses.getResponses())
177177
.map(MultiGetItemResponse::getResponse)
178-
.map(g -> new ElasticsearchEntry(g.getId(), g.getType(), g.getSourceAsMap()))
178+
.map(ElasticsearchEntry::of)
179179
.filter(ElasticsearchEntry::isNotEmpty)
180180
.map(ElasticsearchEntry::toEntity)
181181
.forEach(entities::add);

0 commit comments

Comments
 (0)