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