Class RandomDocumentPicks
java.lang.Object
org.opensearch.ingest.RandomDocumentPicks
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddRandomField(Random random, org.opensearch.ingest.IngestDocument ingestDocument, Object value) Adds a random non existing field to the provided document and associates it with the provided value.static booleancanAddField(String path, org.opensearch.ingest.IngestDocument ingestDocument) Checks whether the provided field name can be safely added to the provided document.static StringrandomExistingFieldName(Random random, org.opensearch.ingest.IngestDocument ingestDocument) Returns a randomly selected existing field name out of the fields that are contained in the document provided as an argument.static StringrandomFieldName(Random random) Returns a random field name.static ObjectrandomFieldValue(Random random) Generates a random field value, can be a string, a number, a list of an object itself.static org.opensearch.ingest.IngestDocumentrandomIngestDocument(Random random) Generates a random document and random metadatastatic org.opensearch.ingest.IngestDocumentrandomIngestDocument(Random random, Map<String, Object> source) Generates a document that holds random metadata and the document provided as a map argumentstatic StringrandomLeafFieldName(Random random) Returns a random leaf field name.static StringrandomNonExistingFieldName(Random random, org.opensearch.ingest.IngestDocument ingestDocument) Returns a random field name that doesn't exist in the document.randomSource(Random random) static StringrandomString(Random random)
-
Method Details
-
randomFieldName
-
randomNonExistingFieldName
-
randomLeafFieldName
-
randomExistingFieldName
-
addRandomField
public static String addRandomField(Random random, org.opensearch.ingest.IngestDocument ingestDocument, Object value) Adds a random non existing field to the provided document and associates it with the provided value. The field will be added at a random position within the document, not necessarily at the top level using a leaf field name. -
canAddField
Checks whether the provided field name can be safely added to the provided document. When the provided field name holds the path using the dot notation, we have to make sure that each node of the tree either doesn't exist or is a map, otherwise new fields cannot be added. -
randomIngestDocument
Generates a random document and random metadata -
randomIngestDocument
-
randomSource
-
randomFieldValue
-
randomString
-