/* 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 System; using System.Collections.Generic; namespace OpenSearch.Client.Specification.IngestApi { public class ProcessorsDescriptor : DescriptorPromiseBase> { public ProcessorsDescriptor() : base(new List()) { } /// /// The ingest attachment plugin lets OpenSearch extract file attachments in common formats /// (such as PPT, XLS, and PDF) by using the Apache text extraction library Tika. /// You can use the ingest attachment plugin as a replacement for the mapper attachment plugin. /// /// /// Requires the Ingest Attachment Processor Plugin to be installed on the cluster. /// public ProcessorsDescriptor Attachment(Func, IAttachmentProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new AttachmentProcessorDescriptor()))); /// public ProcessorsDescriptor Append(Func, IAppendProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new AppendProcessorDescriptor()))); /// public ProcessorsDescriptor Csv(Func, ICsvProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new CsvProcessorDescriptor()))); /// public ProcessorsDescriptor Convert(Func, IConvertProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new ConvertProcessorDescriptor()))); /// public ProcessorsDescriptor Date(Func, IDateProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new DateProcessorDescriptor()))); /// /// Point documents to the right time-based index based on a date or timestamp field in a document /// by using the date math index name support. /// public ProcessorsDescriptor DateIndexName(Func, IDateIndexNameProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new DateIndexNameProcessorDescriptor()))); /// /// Expands a field with dots into an object field. /// This processor allows fields with dots in the name to be accessible by other processors in the pipeline. /// Otherwise these fields can’t be accessed by any processor. /// public ProcessorsDescriptor DotExpander(Func, IDotExpanderProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new DotExpanderProcessorDescriptor()))); /// public ProcessorsDescriptor Fail(Func selector) => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new FailProcessorDescriptor()))); public ProcessorsDescriptor Foreach(Func, IForeachProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new ForeachProcessorDescriptor()))); /// /// Adds information about the geographical location of IP addresses, /// based on data from the Maxmind databases. /// This processor adds this information by default under the geoip field. /// The geoip processor can resolve both IPv4 and IPv6 addresses. /// /// /// Requires the Ingest Geoip Processor Plugin to be installed on the cluster. /// public ProcessorsDescriptor GeoIp(Func, IGeoIpProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new GeoIpProcessorDescriptor()))); public ProcessorsDescriptor Grok(Func, IGrokProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new GrokProcessorDescriptor()))); public ProcessorsDescriptor Gsub(Func, IGsubProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new GsubProcessorDescriptor()))); /// public ProcessorsDescriptor Join(Func, IJoinProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new JoinProcessorDescriptor()))); /// public ProcessorsDescriptor Lowercase(Func, ILowercaseProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new LowercaseProcessorDescriptor()))); /// public ProcessorsDescriptor Remove(Func, IRemoveProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new RemoveProcessorDescriptor()))); /// public ProcessorsDescriptor Rename(Func, IRenameProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new RenameProcessorDescriptor()))); /// /// Allows inline, stored, and file scripts to be executed within ingest pipelines. /// public ProcessorsDescriptor Script(Func selector) => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new ScriptProcessorDescriptor()))); public ProcessorsDescriptor Set(Func, ISetProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new SetProcessorDescriptor()))); /// /// The Sort processor sorts the elements of an array ascending or descending. Homogeneous arrays of numbers /// will be sorted numerically, while arrays of strings or heterogeneous arrays /// of strings and numbers will be sorted lexicographically. /// public ProcessorsDescriptor Sort(Func, ISortProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new SortProcessorDescriptor()))); /// public ProcessorsDescriptor Split(Func, ISplitProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new SplitProcessorDescriptor()))); /// public ProcessorsDescriptor Trim(Func, ITrimProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new TrimProcessorDescriptor()))); /// public ProcessorsDescriptor Uppercase(Func, IUppercaseProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new UppercaseProcessorDescriptor()))); /// /// Converts a JSON string into a structured JSON object. /// public ProcessorsDescriptor Json(Func, IJsonProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new JsonProcessorDescriptor()))); /// /// The user_agent processor extracts details from the user agent string a browser sends with its web requests. /// This processor adds this information by default under the user_agent field. /// The ingest-user-agent plugin ships by default with the regexes.yaml made available by /// uap-java with an Apache 2.0 license. /// /// /// Requires the UserAgent Processor Plugin to be installed on the cluster. /// public ProcessorsDescriptor UserAgent(Func, IUserAgentProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new UserAgentProcessorDescriptor()))); /// public ProcessorsDescriptor Kv(Func, IKeyValueProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new KeyValueProcessorDescriptor()))); /// public ProcessorsDescriptor UrlDecode(Func, IUrlDecodeProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new UrlDecodeProcessorDescriptor()))); /// public ProcessorsDescriptor Bytes(Func, IBytesProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new BytesProcessorDescriptor()))); /// public ProcessorsDescriptor Dissect(Func, IDissectProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new DissectProcessorDescriptor()))); /// public ProcessorsDescriptor Drop(Func selector) => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new DropProcessorDescriptor()))); /// public ProcessorsDescriptor Pipeline(Func selector) => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new PipelineProcessorDescriptor()))); /// public ProcessorsDescriptor UriParts(Func, IUriPartsProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new UriPartsProcessorDescriptor()))); /// public ProcessorsDescriptor Fingerprint(Func, IFingerprintProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new FingerprintProcessorDescriptor()))); /// public ProcessorsDescriptor NetworkCommunityId(Func, INetworkCommunityIdProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new NetworkCommunityIdProcessorDescriptor()))); /// public ProcessorsDescriptor NetworkDirection(Func, INetworkDirectionProcessor> selector) where T : class => Assign(selector, (a, v) => a.AddIfNotNull(v?.Invoke(new NetworkDirectionProcessorDescriptor()))); } }