Class XContentMapValues
org.elasticsearch.common.xcontent.support.XContentMapValues
public class XContentMapValues
extends
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <<?,?>>
nestedPath, <?,?> map)
For the provided nested path, return its source maps from the parent xContent map.static <>
path, <,> map)
Extracts raw values (string, int, and so on) based on the path provided returning all of them as a single list.static
path, <?,?> map)
For the provided path, return its value in the xContent map.static
path, <?,?> map, nullValue)
For the provided path, return its value in the xContent map.static
<?,?> map, ... pathElements)
static <<,?>,<,>>
[] includes, [] excludes)
Returns a function that filters a document map based on the given include and exclude rules.static <,>
<,?> map, [] includes, [] excludes)
Only keep properties inmap
that match theincludes
but not theexcludes
.static boolean
node)
static boolean
node)
static boolean
node)
static boolean
node, boolean defaultValue)
static boolean
node, name)
static boolean
node, name, boolean defaultValue)
static byte
node)
static byte
node, byte defaultValue)
static double
node)
static double
node, double defaultValue)
static float
node)
static float
node, float defaultValue)
static int
node)
static int
node, int defaultValue)
static long
node)
static long
node, long defaultValue)
static <,>
node, desc)
static short
node)
static short
node, short defaultValue)
static []
node)
Returns an array of string value from a node value.static
node)
Returns the value of its input, ornull
if the input is nullstatic
node, defaultValue)
static org.elasticsearch.core.TimeValue
node)
static org.elasticsearch.core.TimeValue
node, org.elasticsearch.core.TimeValue defaultValue)
Methods inherited from class java.lang.
, , , , , , , , , ,
-
Constructor Details
-
XContentMapValues
public XContentMapValues()
-
-
Method Details
-
extractRawValues
public static <> extractRawValues( path, <,> map)Extracts raw values (string, int, and so on) based on the path provided returning all of them as a single list. -
extractValue
public static extractValue( path, <?,?> map)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
public static extractValue(<?,?> map, ... pathElements) -
extractNestedSources
public static <<?,?>> extractNestedSources( nestedPath, <?,?> map)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
public static extractValue( path, <?,?> map, nullValue)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
public static <,> filter(<,?> map, [] includes, [] excludes)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 <<,?>,<,>> filter([] includes, [] excludes)Returns a function that filters a document map based on the given include and exclude rules.- See Also:
for details
-
isObject
public static boolean isObject( node) -
isArray
public static boolean isArray( node) -
nodeStringValue
public static nodeStringValue( node, defaultValue) -
nodeStringValue
public static nodeStringValue( node)Returns the value of its input, ornull
if the input is null -
nodeFloatValue
public static float nodeFloatValue( node, float defaultValue) -
nodeFloatValue
public static float nodeFloatValue( node) -
nodeDoubleValue
public static double nodeDoubleValue( node, double defaultValue) -
nodeDoubleValue
public static double nodeDoubleValue( node) -
nodeIntegerValue
public static int nodeIntegerValue( node) -
nodeIntegerValue
public static int nodeIntegerValue( node, int defaultValue) -
nodeShortValue
public static short nodeShortValue( node, short defaultValue) -
nodeShortValue
public static short nodeShortValue( node) -
nodeByteValue
public static byte nodeByteValue( node, byte defaultValue) -
nodeByteValue
public static byte nodeByteValue( node) -
nodeLongValue
public static long nodeLongValue( node, long defaultValue) -
nodeLongValue
public static long nodeLongValue( node) -
nodeBooleanValue
public static boolean nodeBooleanValue( node, name, boolean defaultValue) -
nodeBooleanValue
public static boolean nodeBooleanValue( node, boolean defaultValue) -
nodeBooleanValue
public static boolean nodeBooleanValue( node, name) -
nodeBooleanValue
public static boolean nodeBooleanValue( node) -
nodeTimeValue
public static org.elasticsearch.core.TimeValue nodeTimeValue( node, org.elasticsearch.core.TimeValue defaultValue) -
nodeTimeValue
public static org.elasticsearch.core.TimeValue nodeTimeValue( node) -
nodeMapValue
public static <,> nodeMapValue( node, desc) -
nodeStringArrayValue
public static [] nodeStringArrayValue( node)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.
-