Class ElasticsearchJson.SearchHit

  • Enclosing class:
    ElasticsearchJson

    static class ElasticsearchJson.SearchHit
    extends java.lang.Object
    Concrete result record which matched the query. Similar to SearchHit in ES.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.lang.Object> fields  
      private java.lang.String id
      ID of the document (not available in aggregations)
      private java.util.Map<java.lang.String,​java.lang.Object> source  
    • Constructor Summary

      Constructors 
      Constructor Description
      SearchHit​(java.lang.String id, java.util.Map<java.lang.String,​java.lang.Object> source, java.util.Map<java.lang.String,​java.lang.Object> fields)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) java.util.Map<java.lang.String,​java.lang.Object> fields()  
      java.lang.String id()
      Returns id of this hit (usually document id)
      (package private) java.util.Map<java.lang.String,​java.lang.Object> source()  
      (package private) java.util.Map<java.lang.String,​java.lang.Object> sourceOrFields()  
      private static java.lang.Object valueFromPath​(java.util.Map<java.lang.String,​java.lang.Object> map, java.lang.String path)
      Returns property from nested maps given a path like a.b.c.
      (package private) java.lang.Object valueOrNull​(java.lang.String name)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • id

        private final java.lang.String id
        ID of the document (not available in aggregations)
      • source

        private final java.util.Map<java.lang.String,​java.lang.Object> source
      • fields

        private final java.util.Map<java.lang.String,​java.lang.Object> fields
    • Constructor Detail

      • SearchHit

        SearchHit​(java.lang.String id,
                  java.util.Map<java.lang.String,​java.lang.Object> source,
                  java.util.Map<java.lang.String,​java.lang.Object> fields)
    • Method Detail

      • id

        public java.lang.String id()
        Returns id of this hit (usually document id)
        Returns:
        unique id
      • valueOrNull

        java.lang.Object valueOrNull​(java.lang.String name)
      • valueFromPath

        private static java.lang.Object valueFromPath​(java.util.Map<java.lang.String,​java.lang.Object> map,
                                                      java.lang.String path)
        Returns property from nested maps given a path like a.b.c.
        Parameters:
        map - current map
        path - field path(s), optionally with dots (a.b.c).
        Returns:
        value located at path path or null if not found.
      • source

        java.util.Map<java.lang.String,​java.lang.Object> source()
      • fields

        java.util.Map<java.lang.String,​java.lang.Object> fields()
      • sourceOrFields

        java.util.Map<java.lang.String,​java.lang.Object> sourceOrFields()