/* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
using OpenSearch.Net;
using System.Runtime.Serialization;
namespace OpenSearch.Client
{
///
/// Configures the destination for a reindex API request
///
public interface IReindexDestination
{
///
/// The index to reindex into
///
[DataMember(Name ="index")]
IndexName Index { get; set; }
///
/// Setting to will cause reindex to only
/// create missing documents in the destination index.
///
[DataMember(Name ="op_type")]
OpType? OpType { get; set; }
///
/// Id of the pipeline to use to process documents
///
string Pipeline { get; set; }
///
/// The routing to use when reindexing
///
[DataMember(Name ="routing")]
ReindexRouting Routing { get; set; }
///
/// Setting to will cause OpenSearch
/// to preserve the version from the source, create any documents that are missing,
/// and update any documents that have an older version in the destination index
/// than they do in the source index
///
[DataMember(Name ="version_type")]
VersionType? VersionType { get; set; }
}
///
public class ReindexDestination : IReindexDestination
{
///
public IndexName Index { get; set; }
///
public OpType? OpType { get; set; }
///
public string Pipeline { get; set; }
///
public ReindexRouting Routing { get; set; }
///
public VersionType? VersionType { get; set; }
}
///
public class ReindexDestinationDescriptor : DescriptorBase, IReindexDestination
{
IndexName IReindexDestination.Index { get; set; }
OpType? IReindexDestination.OpType { get; set; }
string IReindexDestination.Pipeline { get; set; }
ReindexRouting IReindexDestination.Routing { get; set; }
VersionType? IReindexDestination.VersionType { get; set; }
///
public ReindexDestinationDescriptor Routing(ReindexRouting routing) => Assign(routing, (a, v) => a.Routing = v);
///
public ReindexDestinationDescriptor Pipeline(string pipeline) => Assign(pipeline, (a, v) => a.Pipeline = v);
///
public ReindexDestinationDescriptor OpType(OpType? opType) => Assign(opType, (a, v) => a.OpType = v);
///
public ReindexDestinationDescriptor VersionType(VersionType? versionType) => Assign(versionType, (a, v) => a.VersionType = v);
///
public ReindexDestinationDescriptor Index(IndexName index) => Assign(index, (a, v) => a.Index = v);
}
}