Package org.nuxeo.elasticsearch.core
Class EsResultSetImpl
java.lang.Object
org.nuxeo.elasticsearch.core.EsResultSetImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<Map<String,,Serializable>> Iterator<Map<String,,Serializable>> IterableQueryResult
public class EsResultSetImpl
extends Object
implements IterableQueryResult, Iterator<Map<String,Serializable>>
Iterable query result of the results of an Elasticsearch query.
Loads all results in memory.
- Since:
- 7.2
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEsResultSetImpl(org.opensearch.action.search.SearchResponse response, Map<String, Type> selectFieldsAndTypes) -
Method Summary
Modifier and TypeMethodDescriptionprotected List<Map<String,Serializable>> voidclose()Closes the query result and releases the underlying resources held by the cursor.booleanhasNext()iterator()booleanIndicates if the query result must be closed (because it holds resources).next()longpos()Gets the current position in the iterator.longsize()Returns the number of results available in the iterator.voidskipTo(long pos) Skips to a given position in the iterator.longReturns the total number of result that match the query.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Field Details
-
maps
-
size
protected long size
-
-
Constructor Details
-
EsResultSetImpl
-
-
Method Details
-
buildMaps
-
close
public void close()Description copied from interface:IterableQueryResultCloses the query result and releases the underlying resources held by the cursor.This MUST be called when the query result is no more needed, otherwise underlying resources will be leaked. There is no auto-closing at the end of the iteration.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIterableQueryResult
-
mustBeClosed
public boolean mustBeClosed()Description copied from interface:IterableQueryResultIndicates if the query result must be closed (because it holds resources).- Specified by:
mustBeClosedin interfaceIterableQueryResult- Returns:
trueif the query result must be closed,falseotherwise
-
size
public long size()Returns the number of results available in the iterator. Note that before 9.1 this method was returning the totalSize.- Specified by:
sizein interfaceIterableQueryResult- Returns:
- the size, or
-1for an unknown size - Since:
- 9.1
-
totalSize
public long totalSize()Returns the total number of result that match the query.- Since:
- 9.1
-
pos
public long pos()Description copied from interface:IterableQueryResultGets the current position in the iterator.Positions start at
0.- Specified by:
posin interfaceIterableQueryResult- Returns:
- the position
-
skipTo
public void skipTo(long pos) Description copied from interface:IterableQueryResultSkips to a given position in the iterator.Positions start at
0.- Specified by:
skipToin interfaceIterableQueryResult
-
iterator
- Specified by:
iteratorin interfaceIterable<Map<String,Serializable>>
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<Map<String,Serializable>>
-
next
- Specified by:
nextin interfaceIterator<Map<String,Serializable>>
-