Class PagedBytesIndexFieldData.PagedBytesEstimator
java.lang.Object
org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData.PagedBytesEstimator
- All Implemented Interfaces:
AbstractIndexOrdinalsFieldData.PerValueEstimator
- Enclosing class:
- PagedBytesIndexFieldData
public class PagedBytesIndexFieldData.PagedBytesEstimator
extends Object
implements AbstractIndexOrdinalsFieldData.PerValueEstimator
Estimator that wraps string field data by either using
BlockTreeTermsReader, or wrapping the data in a RamAccountingTermsEnum
if the BlockTreeTermsReader cannot be used.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterLoad(org.apache.lucene.index.TermsEnum termsEnum, long actualUsed)
Adjust the circuit breaker now that terms have been loaded, getting the actual used either from the parameter (if estimation worked for the entire set), or from the TermsEnum if it has been wrapped in a RamAccountingTermsEnum.org.apache.lucene.index.TermsEnum
beforeLoad(org.apache.lucene.index.Terms terms)
Determine whether the BlockTreeTermsReader.FieldReader can be used for estimating the field data, adding the estimate to the circuit breaker if it can, otherwise wrapping the terms in a RamAccountingTermsEnum to be estimated on a per-term basis.long
bytesPerValue(org.apache.lucene.util.BytesRef term)
long
-
Method Details
-
bytesPerValue
public long bytesPerValue(org.apache.lucene.util.BytesRef term)- Specified by:
bytesPerValue
in interfaceAbstractIndexOrdinalsFieldData.PerValueEstimator
- Returns:
- the number of bytes for the term based on the length and ordinal overhead
-
estimateStringFieldData
public long estimateStringFieldData()- Returns:
- the estimate for loading the entire term set into field data, or 0 if unavailable
-
beforeLoad
public org.apache.lucene.index.TermsEnum beforeLoad(org.apache.lucene.index.Terms terms) throws IOExceptionDetermine whether the BlockTreeTermsReader.FieldReader can be used for estimating the field data, adding the estimate to the circuit breaker if it can, otherwise wrapping the terms in a RamAccountingTermsEnum to be estimated on a per-term basis.- Specified by:
beforeLoad
in interfaceAbstractIndexOrdinalsFieldData.PerValueEstimator
- Parameters:
terms
- terms to be estimated- Returns:
- A possibly wrapped TermsEnum for the terms
- Throws:
IOException
-
afterLoad
public void afterLoad(org.apache.lucene.index.TermsEnum termsEnum, long actualUsed)Adjust the circuit breaker now that terms have been loaded, getting the actual used either from the parameter (if estimation worked for the entire set), or from the TermsEnum if it has been wrapped in a RamAccountingTermsEnum.- Specified by:
afterLoad
in interfaceAbstractIndexOrdinalsFieldData.PerValueEstimator
- Parameters:
termsEnum
- terms that were loadedactualUsed
- actual field data memory usage
-