Class XContentMapValues
java.lang.Object
org.elasticsearch.common.xcontent.support.XContentMapValues
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractNestedSources(String nestedPath, Map<?,?> map)For the provided nested path, return its source maps from the parent xContent map.extractRawValues(String path, Map<String,Object> map)Extracts raw values (string, int, and so on) based on the path provided returning all of them as a single list.static ObjectextractValue(String path, Map<?,?> map)For the provided path, return its value in the xContent map.static ObjectextractValue(String path, Map<?,?> map, Object nullValue)For the provided path, return its value in the xContent map.static ObjectextractValue(Map<?,?> map, String... pathElements)Returns a function that filters a document map based on the given include and exclude rules.Only keep properties inmapthat match theincludesbut not theexcludes.static booleanstatic booleanstatic booleannodeBooleanValue(Object node)static booleannodeBooleanValue(Object node, boolean defaultValue)static booleannodeBooleanValue(Object node, String name)static booleannodeBooleanValue(Object node, String name, boolean defaultValue)static bytenodeByteValue(Object node)static bytenodeByteValue(Object node, byte defaultValue)static doublenodeDoubleValue(Object node)static doublenodeDoubleValue(Object node, double defaultValue)static floatnodeFloatValue(Object node)static floatnodeFloatValue(Object node, float defaultValue)static intnodeIntegerValue(Object node)static intnodeIntegerValue(Object node, int defaultValue)static longnodeLongValue(Object node)static longnodeLongValue(Object node, long defaultValue)nodeMapValue(Object node, String desc)static shortnodeShortValue(Object node)static shortnodeShortValue(Object node, short defaultValue)static String[]nodeStringArrayValue(Object node)Returns an array of string value from a node value.static StringnodeStringValue(Object node)Returns theObject.toString()value of its input, ornullif the input is nullstatic StringnodeStringValue(Object node, String defaultValue)static org.elasticsearch.core.TimeValuenodeTimeValue(Object node)static org.elasticsearch.core.TimeValuenodeTimeValue(Object node, org.elasticsearch.core.TimeValue defaultValue)
-
Constructor Details
-
XContentMapValues
public XContentMapValues()
-
-
Method Details
-
extractRawValues
Extracts raw values (string, int, and so on) based on the path provided returning all of them as a single list. -
extractValue
For the provided path, return its value in the xContent map. Note that in contrast withextractRawValues(java.lang.String, java.util.Map<java.lang.String, java.lang.Object>), array and object values can be returned.- Parameters:
path- the value's path in the map.- Returns:
- the value associated with the path in the map or 'null' if the path does not exist.
-
extractValue
-
extractNestedSources
For the provided nested path, return its source maps from the parent xContent map.- Parameters:
nestedPath- the nested field value's path in the map.map- the parent source map- Returns:
- a list of source maps or
nullif the path does not exist.
-
extractValue
For the provided path, return its value in the xContent map. Note that in contrast withextractRawValues(java.lang.String, java.util.Map<java.lang.String, java.lang.Object>), array and object values can be returned.- Parameters:
path- the value's path in the map.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 map or 'null' if the path does not exist.
-
filter
Only keep properties inmapthat match theincludesbut not theexcludes. An empty list of includes is interpreted as a wildcard while an empty list of excludes does not match anything. If a property matches both an include and an exclude, then the exclude wins. If an object matches, then any of its sub properties are automatically considered as matching as well, both for includes and excludes. Dots in field names are treated as sub objects. So for instance if a document containsa.bas a property andais an include, thena.bwill be kept in the filtered map. -
filter
public static Function<Map<String,?>,Map<String,Object>> filter(String[] includes, String[] excludes)Returns a function that filters a document map based on the given include and exclude rules.- See Also:
for details
-
isObject
-
isArray
-
nodeStringValue
-
nodeStringValue
Returns theObject.toString()value of its input, ornullif the input is null -
nodeFloatValue
-
nodeFloatValue
-
nodeDoubleValue
-
nodeDoubleValue
-
nodeIntegerValue
-
nodeIntegerValue
-
nodeShortValue
-
nodeShortValue
-
nodeByteValue
-
nodeByteValue
-
nodeLongValue
-
nodeLongValue
-
nodeBooleanValue
-
nodeBooleanValue
-
nodeBooleanValue
-
nodeBooleanValue
-
nodeTimeValue
public static org.elasticsearch.core.TimeValue nodeTimeValue(Object node, org.elasticsearch.core.TimeValue defaultValue) -
nodeTimeValue
-
nodeMapValue
-
nodeStringArrayValue
Returns an array of string value from a node value. If the node represents an array the corresponding array of strings is returned. Otherwise the node is treated as a comma-separated string.
-