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 Type
    Method
    Description
    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.
    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
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • bytesPerValue

      public long bytesPerValue(org.apache.lucene.util.BytesRef term)
      Specified by:
      bytesPerValue in interface AbstractIndexOrdinalsFieldData.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 IOException
      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.
      Specified by:
      beforeLoad in interface AbstractIndexOrdinalsFieldData.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 interface AbstractIndexOrdinalsFieldData.PerValueEstimator
      Parameters:
      termsEnum - terms that were loaded
      actualUsed - actual field data memory usage