org.elasticsearch.xpack.esql.enrich.ResolvedEnrichPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of x-pack-esql Show documentation
Show all versions of x-pack-esql Show documentation
The plugin that powers ESQL for Elasticsearch
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.esql.enrich;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.xpack.esql.core.type.EsField;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public record ResolvedEnrichPolicy(
String matchField,
String matchType,
List enrichFields,
Map concreteIndices,
Map mapping
) implements Writeable {
public ResolvedEnrichPolicy(StreamInput in) throws IOException {
this(
in.readString(),
in.readString(),
in.readStringCollectionAsList(),
in.readMap(StreamInput::readString),
in.readMap(EsField::new)
);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(matchField);
out.writeString(matchType);
out.writeStringCollection(enrichFields);
out.writeMap(concreteIndices, StreamOutput::writeString);
out.writeMap(
mapping,
/*
* There are lots of subtypes of ESField, but we always write the field
* as though it were the base class.
*/
(o, v) -> new EsField(v.getName(), v.getDataType(), v.getProperties(), v.isAggregatable(), v.isAlias()).writeTo(o)
);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy