Class XContentMapValues
java.lang.Object
org.elasticsearch.common.xcontent.support.XContentMapValues
-
Constructor Summary
-
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 Object
extractValue(String path, Map<?,?> map)
For the provided path, return its value in the xContent map.static Object
extractValue(String path, Map<?,?> map, Object nullValue)
For the provided path, return its value in the xContent map.static Object
extractValue(Map<?,?> map, String... pathElements)
Returns a function that filters a document map based on the given include and exclude rules.Only keep properties inmap
that match theincludes
but not theexcludes
.static boolean
static boolean
static boolean
nodeBooleanValue(Object node)
static boolean
nodeBooleanValue(Object node, boolean defaultValue)
static boolean
nodeBooleanValue(Object node, String name)
static boolean
nodeBooleanValue(Object node, String name, boolean defaultValue)
static byte
nodeByteValue(Object node)
static byte
nodeByteValue(Object node, byte defaultValue)
static double
nodeDoubleValue(Object node)
static double
nodeDoubleValue(Object node, double defaultValue)
static float
nodeFloatValue(Object node)
static float
nodeFloatValue(Object node, float defaultValue)
static int
nodeIntegerValue(Object node)
static int
nodeIntegerValue(Object node, int defaultValue)
static long
nodeLongValue(Object node)
static long
nodeLongValue(Object node, long defaultValue)
nodeMapValue(Object node, String desc)
static short
nodeShortValue(Object node)
static short
nodeShortValue(Object node, short defaultValue)
static String[]
nodeStringArrayValue(Object node)
Returns an array of string value from a node value.static String
nodeStringValue(Object node)
Returns theObject.toString()
value of its input, ornull
if the input is nullstatic String
nodeStringValue(Object node, String defaultValue)
static org.elasticsearch.core.TimeValue
nodeTimeValue(Object node)
static org.elasticsearch.core.TimeValue
nodeTimeValue(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
null
if 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 inmap
that match theincludes
but 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.b
as a property anda
is an include, thena.b
will 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, ornull
if 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.
-