Package org.elasticsearch.ingest
Class RandomDocumentPicks
java.lang.Object
org.elasticsearch.ingest.RandomDocumentPicks
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddRandomField(Random random, 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, IngestDocument ingestDocument) Checks whether the provided field name can be safely added to the provided document.static StringrandomExistingFieldName(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 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 IngestDocumentrandomIngestDocument(Random random) Generates a random document and random metadatastatic 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.randomSource(Random random) static StringrandomString(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
-