Package org.elasticsearch.ingest
Class RandomDocumentPicks
java.lang.Object
org.elasticsearch.ingest.RandomDocumentPicks
public final class RandomDocumentPicks
extends java.lang.Object
-
Method Summary
Modifier and Type Method Description static java.lang.String
addRandomField(java.util.Random random, org.elasticsearch.ingest.IngestDocument ingestDocument, java.lang.Object value)
Adds a random non existing field to the provided document and associates it with the provided value.static boolean
canAddField(java.lang.String path, org.elasticsearch.ingest.IngestDocument ingestDocument)
Checks whether the provided field name can be safely added to the provided document.static java.lang.String
randomExistingFieldName(java.util.Random random, org.elasticsearch.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 java.lang.String
randomFieldName(java.util.Random random)
Returns a random field name.static java.lang.Object
randomFieldValue(java.util.Random random)
Generates a random field value, can be a string, a number, a list of an object itself.static org.elasticsearch.ingest.IngestDocument
randomIngestDocument(java.util.Random random)
Generates a random document and random metadatastatic org.elasticsearch.ingest.IngestDocument
randomIngestDocument(java.util.Random random, java.util.Map<java.lang.String,java.lang.Object> source)
Generates a document that holds random metadata and the document provided as a map argumentstatic java.lang.String
randomLeafFieldName(java.util.Random random)
Returns a random leaf field name.static java.util.Map<java.lang.String,java.lang.Object>
randomSource(java.util.Random random)
static java.lang.String
randomString(java.util.Random random)
-
Method Details
-
randomFieldName
public static java.lang.String randomFieldName(java.util.Random random)Returns a random field name. Can be a leaf field name or the path to refer to a field name using the dot notation. -
randomLeafFieldName
public static java.lang.String randomLeafFieldName(java.util.Random random)Returns a random leaf field name. -
randomExistingFieldName
public static java.lang.String randomExistingFieldName(java.util.Random random, org.elasticsearch.ingest.IngestDocument ingestDocument)Returns a randomly selected existing field name out of the fields that are contained in the document provided as an argument. -
addRandomField
public static java.lang.String addRandomField(java.util.Random random, org.elasticsearch.ingest.IngestDocument ingestDocument, java.lang.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
public static boolean canAddField(java.lang.String path, org.elasticsearch.ingest.IngestDocument ingestDocument)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
public static org.elasticsearch.ingest.IngestDocument randomIngestDocument(java.util.Random random)Generates a random document and random metadata -
randomIngestDocument
public static org.elasticsearch.ingest.IngestDocument randomIngestDocument(java.util.Random random, java.util.Map<java.lang.String,java.lang.Object> source)Generates a document that holds random metadata and the document provided as a map argument -
randomSource
public static java.util.Map<java.lang.String,java.lang.Object> randomSource(java.util.Random random) -
randomFieldValue
public static java.lang.Object randomFieldValue(java.util.Random random)Generates a random field value, can be a string, a number, a list of an object itself. -
randomString
public static java.lang.String randomString(java.util.Random random)
-