Class XContentSource

java.lang.Object
org.elasticsearch.client.common.XContentSource

public class XContentSource extends Object
Encapsulates the xcontent source
  • Constructor Details

    • XContentSource

      public XContentSource(org.elasticsearch.xcontent.XContentParser parser) throws IOException
      Constructs a new XContentSource out of the given parser
      Throws:
      IOException
  • Method Details

    • isMap

      public boolean isMap()
      Returns:
      true if the top level value of the source is a map
    • getAsMap

      public Map<String,Object> getAsMap()
      Returns:
      The source as a map
    • isList

      public boolean isList()
      Returns:
      true if the top level value of the source is a list
    • getAsList

      public List<Object> getAsList()
      Returns:
      The source as a list
    • getValue

      public <T> T getValue(String path)
      Extracts a value identified by the given path in the source.
      Parameters:
      path - a dot notation path to the requested value
      Returns:
      The extracted value or null if no value is associated with the given path