public final class ElasticsearchUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
FIELD_NAMES_FIELD
JSON field-name of normalized field-names.
|
protected static String |
NORMALIZED_FIELD
JSON field-name of metadata to assist in de-normalization.
|
static com.fasterxml.jackson.databind.ObjectMapper |
OBJECT_MAPPER
Jackson
ObjectMapper for working with JSON. |
| Modifier and Type | Method and Description |
|---|---|
static JsonValue |
denormalizeJson(JsonValue value)
De-normalizes JSON that was previously normalized by
normalizeJson(JsonValue). |
static String |
normalizeJson(JsonValue value)
Normalizes JSON to conform to Elasticsearch data-format restrictions.
|
static JsonPointer |
normalizeJsonPointer(JsonPointer ptr)
Replaces periods in
JsonPointer keys with underscore. |
static boolean |
renameField(JsonValue jsonValue,
String oldKey,
String newKey)
Renames a field within the given
JsonValue. |
protected static String |
replaceKeyPeriodsWithUnderscores(String json)
Replaces all period-characters in JSON keys with underscore-characters
[ref].
|
protected static JsonValue |
restoreKeyPeriods(JsonValue value,
JsonValue normalized)
Reverses the normalization steps preformed by
replaceKeyPeriodsWithUnderscores(String). |
public static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
ObjectMapper for working with JSON.protected static final String NORMALIZED_FIELD
protected static final String FIELD_NAMES_FIELD
public static String normalizeJson(JsonValue value) throws IOException
"_normalized" : {
"fieldNames" : {
"key_1" : "key.1",
"key_2" : "key.2"
}
}
value - JSON value_normalized field if any normalization was necessaryIOException - If unable to parse the json.public static JsonValue denormalizeJson(JsonValue value) throws IOException
normalizeJson(JsonValue).value - JSON valueIOException - If unable to parse the json.protected static String replaceKeyPeriodsWithUnderscores(String json) throws IOException
fieldNames field will be added to the normalized metadata.json - JSON String inputStringIOException - If unable to parse the json.protected static JsonValue restoreKeyPeriods(JsonValue value, JsonValue normalized) throws IOException
replaceKeyPeriodsWithUnderscores(String).value - JSON inputnormalized - De-normalization metadata, which this method may add toIOException - If unable to parse the json.public static JsonPointer normalizeJsonPointer(JsonPointer ptr)
JsonPointer keys with underscore.ptr - The JsonPointer to normalize.JsonPointer.public static boolean renameField(JsonValue jsonValue, String oldKey, String newKey)
JsonValue.jsonValue - JsonValue to have a top-level field renamedoldKey - Old field namenewKey - New field name (field must not already exist)true if field was found and renamed, and false otherwiseCopyright © 2025 Open Identity Platform Community. All rights reserved.