
org.elasticsearch.ingest.Pipeline Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elasticsearch Show documentation
Show all versions of elasticsearch Show documentation
Elasticsearch - Open Source, Distributed, RESTful Search Engine
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
package org.elasticsearch.ingest;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.script.ScriptService;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.LongSupplier;
/**
* A pipeline is a list of {@link Processor} instances grouped under a unique id.
*/
public final class Pipeline {
public static final String DESCRIPTION_KEY = "description";
public static final String PROCESSORS_KEY = "processors";
public static final String VERSION_KEY = "version";
public static final String ON_FAILURE_KEY = "on_failure";
public static final String META_KEY = "_meta";
private final String id;
@Nullable
private final String description;
@Nullable
private final Integer version;
@Nullable
private final Map metadata;
private final CompoundProcessor compoundProcessor;
private final IngestMetric metrics;
private final LongSupplier relativeTimeProvider;
public Pipeline(
String id,
@Nullable String description,
@Nullable Integer version,
@Nullable Map metadata,
CompoundProcessor compoundProcessor
) {
this(id, description, version, metadata, compoundProcessor, System::nanoTime);
}
// package private for testing
Pipeline(
String id,
@Nullable String description,
@Nullable Integer version,
@Nullable Map metadata,
CompoundProcessor compoundProcessor,
LongSupplier relativeTimeProvider
) {
this.id = id;
this.description = description;
this.metadata = metadata;
this.compoundProcessor = compoundProcessor;
this.version = version;
this.metrics = new IngestMetric();
this.relativeTimeProvider = relativeTimeProvider;
}
public static Pipeline create(
String id,
Map config,
Map processorFactories,
ScriptService scriptService
) throws Exception {
String description = ConfigurationUtils.readOptionalStringProperty(null, null, config, DESCRIPTION_KEY);
Integer version = ConfigurationUtils.readIntProperty(null, null, config, VERSION_KEY, null);
Map metadata = ConfigurationUtils.readOptionalMap(null, null, config, META_KEY);
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy