Class SourceLookup

java.lang.Object
org.elasticsearch.search.lookup.SourceLookup
All Implemented Interfaces:
java.util.Map<java.lang.String,​java.lang.Object>

public class SourceLookup
extends java.lang.Object
implements java.util.Map<java.lang.String,​java.lang.Object>
  • Nested Class Summary

    Nested classes/interfaces inherited from interface java.util.Map

    java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
  • Constructor Summary

    Constructors
    Constructor Description
    SourceLookup()  
  • Method Summary

    Modifier and Type Method Description
    void clear()  
    boolean containsKey​(java.lang.Object key)  
    boolean containsValue​(java.lang.Object value)  
    int docId()  
    java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> entrySet()  
    java.util.List<java.lang.Object> extractRawValues​(java.lang.String path)
    Returns the values associated with the path.
    java.lang.Object extractValue​(java.lang.String path, java.lang.Object nullValue)
    For the provided path, return its value in the source.
    java.lang.Object filter​(FetchSourceContext context)  
    java.lang.Object get​(java.lang.Object key)  
    BytesReference internalSourceRef()
    Internal source representation, might be compressed....
    boolean isEmpty()  
    java.util.Set<java.lang.String> keySet()  
    java.lang.Object put​(java.lang.String key, java.lang.Object value)  
    void putAll​(java.util.Map m)  
    java.lang.Object remove​(java.lang.Object key)  
    void setSegmentAndDocument​(org.apache.lucene.index.LeafReaderContext context, int docId)  
    void setSource​(java.util.Map<java.lang.String,​java.lang.Object> source)  
    void setSource​(BytesReference source)  
    void setSourceContentType​(org.elasticsearch.common.xcontent.XContentType sourceContentType)  
    int size()  
    java.util.Map<java.lang.String,​java.lang.Object> source()
    Return the source as a map that will be unchanged when the lookup moves to a different document.
    static java.util.Map<java.lang.String,​java.lang.Object> sourceAsMap​(BytesReference source)
    Get the source as a Map of java objects.
    org.elasticsearch.common.xcontent.XContentType sourceContentType()  
    java.util.Collection<java.lang.Object> values()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.Map

    compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
  • Constructor Details

    • SourceLookup

      public SourceLookup()
  • Method Details

    • sourceContentType

      public org.elasticsearch.common.xcontent.XContentType sourceContentType()
    • docId

      public int docId()
    • source

      public java.util.Map<java.lang.String,​java.lang.Object> source()
      Return the source as a map that will be unchanged when the lookup moves to a different document.

      Important: This can lose precision on numbers with a decimal point. It converts numbers like "n": 1234.567 to a double which only has 52 bits of precision in the mantissa. This will come up most frequently when folks write nanosecond precision dates as a decimal number.

    • sourceAsMap

      public static java.util.Map<java.lang.String,​java.lang.Object> sourceAsMap​(BytesReference source) throws ElasticsearchParseException
      Get the source as a Map of java objects.

      Important: This can lose precision on numbers with a decimal point. It converts numbers like "n": 1234.567 to a double which only has 52 bits of precision in the mantissa. This will come up most frequently when folks write nanosecond precision dates as a decimal number.

      Throws:
      ElasticsearchParseException
    • setSegmentAndDocument

      public void setSegmentAndDocument​(org.apache.lucene.index.LeafReaderContext context, int docId)
    • setSource

      public void setSource​(BytesReference source)
    • setSourceContentType

      public void setSourceContentType​(org.elasticsearch.common.xcontent.XContentType sourceContentType)
    • setSource

      public void setSource​(java.util.Map<java.lang.String,​java.lang.Object> source)
    • internalSourceRef

      public BytesReference internalSourceRef()
      Internal source representation, might be compressed....
    • extractRawValues

      public java.util.List<java.lang.Object> extractRawValues​(java.lang.String path)
      Returns the values associated with the path. Those are "low" level values, and it can handle path expression where an array/list is navigated within.
    • extractValue

      public java.lang.Object extractValue​(java.lang.String path, @Nullable java.lang.Object nullValue)
      For the provided path, return its value in the source. Note that in contrast with extractRawValues(java.lang.String), array and object values can be returned.
      Parameters:
      path - the value's path in the source.
      nullValue - a value to return if the path exists, but the value is 'null'. This helps in distinguishing between a path that doesn't exist vs. a value of 'null'.
      Returns:
      the value associated with the path in the source or 'null' if the path does not exist.
    • filter

      public java.lang.Object filter​(FetchSourceContext context)
    • get

      public java.lang.Object get​(java.lang.Object key)
      Specified by:
      get in interface java.util.Map<java.lang.String,​java.lang.Object>
    • size

      public int size()
      Specified by:
      size in interface java.util.Map<java.lang.String,​java.lang.Object>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface java.util.Map<java.lang.String,​java.lang.Object>
    • containsKey

      public boolean containsKey​(java.lang.Object key)
      Specified by:
      containsKey in interface java.util.Map<java.lang.String,​java.lang.Object>
    • containsValue

      public boolean containsValue​(java.lang.Object value)
      Specified by:
      containsValue in interface java.util.Map<java.lang.String,​java.lang.Object>
    • keySet

      public java.util.Set<java.lang.String> keySet()
      Specified by:
      keySet in interface java.util.Map<java.lang.String,​java.lang.Object>
    • values

      public java.util.Collection<java.lang.Object> values()
      Specified by:
      values in interface java.util.Map<java.lang.String,​java.lang.Object>
    • entrySet

      public java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> entrySet()
      Specified by:
      entrySet in interface java.util.Map<java.lang.String,​java.lang.Object>
    • put

      public java.lang.Object put​(java.lang.String key, java.lang.Object value)
      Specified by:
      put in interface java.util.Map<java.lang.String,​java.lang.Object>
    • remove

      public java.lang.Object remove​(java.lang.Object key)
      Specified by:
      remove in interface java.util.Map<java.lang.String,​java.lang.Object>
    • putAll

      public void putAll​(java.util.Map m)
      Specified by:
      putAll in interface java.util.Map<java.lang.String,​java.lang.Object>
    • clear

      public void clear()
      Specified by:
      clear in interface java.util.Map<java.lang.String,​java.lang.Object>