Package org.elasticsearch.ingest
Class IngestPipelineTestUtils
java.lang.Object
org.elasticsearch.ingest.IngestPipelineTestUtils
Utils for creating/retrieving/deleting ingest pipelines in a test cluster.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddeletePipelinesIgnoringExceptions(ElasticsearchClient client, Iterable<String> ids) Attempt to delete the ingest pipeline with the givenid, using the givenElasticsearchClient, and logging (but otherwise ignoring) the result.static voiddoWithAccessPattern(IngestPipelineFieldAccessPattern accessPattern, IngestDocument document, Consumer<IngestDocument> action) Executes an action against an ingest document using a random access pattern.static voiddoWithRandomAccessPattern(IngestDocument document, Consumer<IngestDocument> action) Executes an action against an ingest document using a random access pattern.static SimulatePipelineRequestjsonSimulatePipelineRequest(String jsonString) Construct a newSimulatePipelineRequestwhose content is the given JSON document, represented as aString.static SimulatePipelineRequestjsonSimulatePipelineRequest(BytesReference jsonBytes) Construct a newSimulatePipelineRequestwhose content is the given JSON document, represented as aBytesReference.static voidputJsonPipeline(ElasticsearchClient client, String id, String jsonString) Create an ingest pipeline with the given ID and body, using the givenElasticsearchClient.static voidputJsonPipeline(ElasticsearchClient client, String id, BytesReference source) Create an ingest pipeline with the given ID and body, using the givenElasticsearchClient.static voidputJsonPipeline(ElasticsearchClient client, String id, org.elasticsearch.xcontent.ToXContentFragment toXContent) Create an ingest pipeline with the given ID and body, using the givenElasticsearchClient.static PutPipelineRequestputJsonPipelineRequest(String id, String jsonString) static PutPipelineRequestputJsonPipelineRequest(String id, BytesReference source) static IngestDocumentrunWithAccessPattern(IngestPipelineFieldAccessPattern accessPattern, IngestDocument document, Processor processor) Executes a processor against an ingest document using the provided access pattern.static IngestDocumentrunWithRandomAccessPattern(IngestDocument document, Processor processor) Executes a processor against an ingest document using a random access pattern.
-
Method Details
-
putJsonPipelineRequest
- Parameters:
id- The pipeline id.source- The body of thePutPipelineRequestas a JSON-formattedBytesReference.- Returns:
- a new
PutPipelineRequestwith the givenidand body.
-
putJsonPipelineRequest
- Parameters:
id- The pipeline id.jsonString- The body of thePutPipelineRequestas a JSON-formattedString.- Returns:
- a new
PutPipelineRequestwith the givenidand body.
-
putJsonPipeline
Create an ingest pipeline with the given ID and body, using the givenElasticsearchClient.- Parameters:
client- The client to use to execute thePutPipelineTransportAction.id- The pipeline id.source- The body of thePutPipelineRequestas a JSON-formattedBytesReference.
-
putJsonPipeline
Create an ingest pipeline with the given ID and body, using the givenElasticsearchClient.- Parameters:
client- The client to use to execute thePutPipelineTransportAction.id- The pipeline id.jsonString- The body of thePutPipelineRequestas a JSON-formattedString.
-
putJsonPipeline
public static void putJsonPipeline(ElasticsearchClient client, String id, org.elasticsearch.xcontent.ToXContentFragment toXContent) throws IOException Create an ingest pipeline with the given ID and body, using the givenElasticsearchClient.- Parameters:
client- The client to use to execute thePutPipelineTransportAction.id- The pipeline id.toXContent- The body of thePutPipelineRequestas aToXContentFragment.- Throws:
IOException
-
deletePipelinesIgnoringExceptions
public static void deletePipelinesIgnoringExceptions(ElasticsearchClient client, Iterable<String> ids) Attempt to delete the ingest pipeline with the givenid, using the givenElasticsearchClient, and logging (but otherwise ignoring) the result. -
jsonSimulatePipelineRequest
Construct a newSimulatePipelineRequestwhose content is the given JSON document, represented as aString. -
jsonSimulatePipelineRequest
Construct a newSimulatePipelineRequestwhose content is the given JSON document, represented as aBytesReference. -
doWithRandomAccessPattern
public static void doWithRandomAccessPattern(IngestDocument document, Consumer<IngestDocument> action) throws Exception Executes an action against an ingest document using a random access pattern. A synthetic pipeline instance with the provided access pattern is created and executed against the ingest document, thus updating its internal access pattern.- Parameters:
document- The document to operate onaction- A consumer which takes the updated ingest document during execution- Throws:
Exception- Any exception thrown from the provided consumer
-
doWithAccessPattern
public static void doWithAccessPattern(IngestPipelineFieldAccessPattern accessPattern, IngestDocument document, Consumer<IngestDocument> action) throws Exception Executes an action against an ingest document using a random access pattern. A synthetic pipeline instance with the provided access pattern is created and executed against the ingest document, thus updating its internal access pattern.- Parameters:
accessPattern- The access pattern to use when executing the block of codedocument- The document to operate onaction- A consumer which takes the updated ingest document during execution- Throws:
Exception- Any exception thrown from the provided consumer
-
runWithRandomAccessPattern
public static IngestDocument runWithRandomAccessPattern(IngestDocument document, Processor processor) throws Exception Executes a processor against an ingest document using a random access pattern. A synthetic pipeline instance with the provided access pattern is created and executed against the ingest document, thus updating its internal access pattern.- Parameters:
document- The document to operate onprocessor- A processor which takes the updated ingest document during execution- Returns:
- the resulting ingest document instance
- Throws:
Exception- Any exception thrown from the provided consumer
-
runWithAccessPattern
public static IngestDocument runWithAccessPattern(IngestPipelineFieldAccessPattern accessPattern, IngestDocument document, Processor processor) throws Exception Executes a processor against an ingest document using the provided access pattern. A synthetic pipeline instance with the provided access pattern is created and executed against the ingest document, thus updating its internal access pattern.- Parameters:
accessPattern- The access pattern to use when executing the block of codedocument- The document to operate onprocessor- A processor which takes the updated ingest document during execution- Returns:
- the resulting ingest document instance
- Throws:
Exception- Any exception thrown from the provided consumer
-