Module org.elasticsearch.compute
Package org.elasticsearch.compute.lucene
Interface IndexedByShardId<T>
- All Known Implementing Classes:
AlwaysReferencedIndexedByShardId,FirstDocIdGroupingAggregatorFunction.MappedShardRefs,IndexedByShardIdFromList,IndexedByShardIdFromSingleton
public interface IndexedByShardId<T>
Ceci n'est pas une List (though it may be backed by one).
Using this interface instead of a list makes it explicit that the values are not necessarily continuous by index, especially after the
reduce-side top n operation has been run, or it can be sliced up into groups, e.g., 0..10, 10..20, etc., as done in
DataNodeComputeHandler and with the help of the ComputeSearchContextByShardId subclass, which is the main production implementation.
When you see this class, it will usually be parameterized by
ShardContext, its super classes, or one of its variants,
e.g., LuceneQueryEvaluator.ShardConfig.
These shard IDs are sliced up by DataNodeComputeHandler, and depend on the MAX_CONCURRENT_SHARDS_PER_NODE setting.-
Method Summary
Modifier and TypeMethodDescriptionget(int shardId) default booleanisEmpty()iterable()This is not necessarily an iterable of all values visible via get(int), but rather, an iterable of the relevant values.<S> IndexedByShardId<S> The elements are mapped lazily, i.e., the function would also apply to future elements (as opposed tocollection().stream().map, which only maps the current elements).intsize()The number of elements returned byiterable().
-
Method Details
-
get
-
iterable
This is not necessarily an iterable of all values visible via get(int), but rather, an iterable of the relevant values. This is useful when you need to perform an operation over all relevant values, e.g., closing them. -
size
int size()The number of elements returned byiterable(). -
isEmpty
default boolean isEmpty() -
map
The elements are mapped lazily, i.e., the function would also apply to future elements (as opposed tocollection().stream().map, which only maps the current elements).
-