From bc6baf22be1a5568603fab8d730cec60fcd1fff2 Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Tue, 4 May 2021 07:03:13 +0100 Subject: [PATCH 1/5] Add NEST support for EQL Search API (#5658) * Add request and response classes * Code gen for EQL search * Add initial request properties * Initial response for testing * Un-skip EQL APIs from high-level code gen * Generate EQL code * Work on request and response types * Add event type for EQL * Update NEST code gen with license headers * Update request/response * Adding initial test * Support generic searches * Fixing URLs and adding URL tests * Add descriptor methods * Add sequence tests * Remove interfaces and update comments. * Remove redundant code in TimeSeriesCluster * Cleanup namespaces * Update license headers * Update headers * Remove UTF-8 BOM (cherry picked from commit f96a6f94f82d81d954263df8e290c8b00ffefab1) --- .github/check-license-headers.sh | 2 +- .../Configuration/CodeConfiguration.cs | 4 - .../_Patches/eql.search.patch.json | 12 + src/Nest/Search/Search/Hits/HitsMetaData.cs | 3 +- src/Nest/XPack/Eql/Events/Event.cs | 52 +++++ .../XPack/Eql/Events/EventHitsMetadata.cs | 47 ++++ src/Nest/XPack/Eql/Events/Sequence.cs | 40 ++++ .../XPack/Eql/Search/EqlResultPosition.cs | 34 +++ src/Nest/XPack/Eql/Search/EqlSearchRequest.cs | 209 ++++++++++++++++++ .../XPack/Eql/Search/EqlSearchResponse.cs | 94 ++++++++ .../Clusters/TimeSeriesCluster.cs | 20 +- .../ConnectionSettingsExtensions.cs | 3 + tests/Tests.Domain/Log.cs | 13 +- .../Troubleshooting/AuditTrail.doc.cs | 5 +- .../XPack/Eql/Search/EqlSearchApiTests.cs | 201 +++++++++++++++++ .../XPack/Eql/Search/EqlSearchUrlTests.cs | 62 ++++++ 16 files changed, 783 insertions(+), 18 deletions(-) create mode 100644 src/ApiGenerator/RestSpecification/_Patches/eql.search.patch.json create mode 100644 src/Nest/XPack/Eql/Events/Event.cs create mode 100644 src/Nest/XPack/Eql/Events/EventHitsMetadata.cs create mode 100644 src/Nest/XPack/Eql/Events/Sequence.cs create mode 100644 src/Nest/XPack/Eql/Search/EqlResultPosition.cs create mode 100644 src/Nest/XPack/Eql/Search/EqlSearchRequest.cs create mode 100644 src/Nest/XPack/Eql/Search/EqlSearchResponse.cs create mode 100644 tests/Tests/XPack/Eql/Search/EqlSearchApiTests.cs create mode 100644 tests/Tests/XPack/Eql/Search/EqlSearchUrlTests.cs diff --git a/.github/check-license-headers.sh b/.github/check-license-headers.sh index bcd8a3c75b7..03f3880dbba 100755 --- a/.github/check-license-headers.sh +++ b/.github/check-license-headers.sh @@ -16,7 +16,7 @@ NLINES=$(wc -l .github/license-header.txt | awk '{print $1}') function check_license_header { local f f=$1 - if ! diff .github/license-header.txt <(head -$NLINES "$f") >/dev/null; then + if ! diff -a --strip-trailing-cr .github/license-header.txt <(head -$NLINES "$f") >/dev/null; then echo "check-license-headers: error: '$f' does not have required license header, see 'diff -u .github/license-header.txt <(head -$NLINES $f)'" return 1 else diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 03e1b18cc01..29af1076b6b 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -98,10 +98,6 @@ public static class CodeConfiguration "cluster.get_component_template.json", // 7.8 experimental "cluster.put_component_template.json", // 7.8 experimental "cluster.exists_component_template.json", // 7.8 experimental - - "eql.search.json", // 7.9 beta - "eql.get.json", // 7.9 beta - "eql.delete.json", // 7.9 beta }; /// diff --git a/src/ApiGenerator/RestSpecification/_Patches/eql.search.patch.json b/src/ApiGenerator/RestSpecification/_Patches/eql.search.patch.json new file mode 100644 index 00000000000..df365fefc65 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/_Patches/eql.search.patch.json @@ -0,0 +1,12 @@ +{ + "eql.search": { + "url": { + "parts": { + "index": { + "type" : "list", + "description" : "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" + } + } + } + } + } \ No newline at end of file diff --git a/src/Nest/Search/Search/Hits/HitsMetaData.cs b/src/Nest/Search/Search/Hits/HitsMetaData.cs index f40c1ccb616..78fdf8ef068 100644 --- a/src/Nest/Search/Search/Hits/HitsMetaData.cs +++ b/src/Nest/Search/Search/Hits/HitsMetaData.cs @@ -36,8 +36,7 @@ public interface IHitsMetadata where T : class [DataMember(Name = "total")] TotalHits Total { get; } } - - + public class HitsMetadata : IHitsMetadata where T : class { diff --git a/src/Nest/XPack/Eql/Events/Event.cs b/src/Nest/XPack/Eql/Events/Event.cs new file mode 100644 index 00000000000..7c676cbf343 --- /dev/null +++ b/src/Nest/XPack/Eql/Events/Event.cs @@ -0,0 +1,52 @@ +/* + * 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.Runtime.Serialization; +using Elasticsearch.Net.Utf8Json; + +namespace Nest +{ + public class Event where TEvent : class + { + /// + /// The individual fields requested for a event. + /// + [DataMember(Name = "fields")] + public FieldValues Fields { get; internal set; } + + /// + /// The id of the event. + /// + [DataMember(Name = "_id")] + public string Id { get; internal set; } + + /// + /// The index in which the event resides. + /// + [DataMember(Name = "_index")] + public string Index { get; internal set; } + + /// + /// The source document for the event. + /// + [DataMember(Name = "_source")] + [JsonFormatter(typeof(SourceFormatter<>))] + public TEvent Source { get; internal set; } + } +} diff --git a/src/Nest/XPack/Eql/Events/EventHitsMetadata.cs b/src/Nest/XPack/Eql/Events/EventHitsMetadata.cs new file mode 100644 index 00000000000..52fb5da0157 --- /dev/null +++ b/src/Nest/XPack/Eql/Events/EventHitsMetadata.cs @@ -0,0 +1,47 @@ +/* + * 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.Collections.Generic; +using System.Runtime.Serialization; +using Elasticsearch.Net; + +namespace Nest +{ + public class EqlHitsMetadata + where TEvent : class + { + /// + /// Contains events matching the query. Each object represents a matching event. + /// + [DataMember(Name = "events")] + public IReadOnlyCollection> Events { get; internal set; } = EmptyReadOnly>.Collection; + + /// + /// Contains event sequences matching the query. Each object represents a matching sequence. This parameter is only returned for EQL queries containing a sequence. + /// + [DataMember(Name = "sequences")] + public IReadOnlyCollection> Sequences { get; internal set; } = EmptyReadOnly>.Collection; + + /// + /// Metadata about the number of matching events or sequences. + /// + [DataMember(Name = "total")] + public TotalHits Total { get; internal set; } + } +} diff --git a/src/Nest/XPack/Eql/Events/Sequence.cs b/src/Nest/XPack/Eql/Events/Sequence.cs new file mode 100644 index 00000000000..bb716a715e7 --- /dev/null +++ b/src/Nest/XPack/Eql/Events/Sequence.cs @@ -0,0 +1,40 @@ +/* + * 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.Collections.Generic; +using System.Runtime.Serialization; +using Elasticsearch.Net; + +namespace Nest +{ + public class Sequence where TEvent : class + { + /// + /// Contains events matching the query. Each object represents a matching event. + /// + [DataMember(Name = "events")] + public IReadOnlyCollection> Events { get; internal set; } = EmptyReadOnly>.Collection; + + /// + /// Shared field values used to constrain matches in the sequence. These are defined using the by keyword in the EQL query syntax. + /// + [DataMember(Name = "join_keys")] + public IReadOnlyCollection JoinKeys { get; internal set; } = EmptyReadOnly.Collection; + } +} diff --git a/src/Nest/XPack/Eql/Search/EqlResultPosition.cs b/src/Nest/XPack/Eql/Search/EqlResultPosition.cs new file mode 100644 index 00000000000..b3e860ebd28 --- /dev/null +++ b/src/Nest/XPack/Eql/Search/EqlResultPosition.cs @@ -0,0 +1,34 @@ +/* + * 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.Runtime.Serialization; +using Elasticsearch.Net; + +namespace Nest +{ + [StringEnum] + public enum EqlResultPosition + { + [EnumMember(Value = "head")] + Head, + + [EnumMember(Value = "tail")] + Tail + } +} diff --git a/src/Nest/XPack/Eql/Search/EqlSearchRequest.cs b/src/Nest/XPack/Eql/Search/EqlSearchRequest.cs new file mode 100644 index 00000000000..4efb8213479 --- /dev/null +++ b/src/Nest/XPack/Eql/Search/EqlSearchRequest.cs @@ -0,0 +1,209 @@ +/* + * 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.Linq.Expressions; +using System.Runtime.Serialization; +using Elasticsearch.Net.Utf8Json; + +namespace Nest +{ + [MapsApi("eql.search.json")] + [ReadAs(typeof(EqlSearchRequest))] + public partial interface IEqlSearchRequest : ITypedSearchRequest + { + /// + /// The EQL search API uses the event.category field from the ECS by default. To specify a different field, + /// set . + /// + [DataMember(Name = "event_category_field")] + Field EventCategoryField { get; set; } + + /// + /// Maximum number of events to search at a time for sequence queries. + /// + [DataMember(Name = "fetch_size")] + int? FetchSize { get; set; } + + /// + /// Allows for retrieving a list of document fields in the search response. + /// + [DataMember(Name = "fields")] + Fields Fields { get; set; } + + /// + /// Further filter the results returned by the SQL query provided on + /// + [DataMember(Name = "filter")] + QueryContainer Filter { get; set; } + + /// The SQL query you want Elasticsearch to execute + [DataMember(Name = "query")] + string Query { get; set; } + + [DataMember(Name = "result_position")] + EqlResultPosition? ResultPosition { get; set; } + + /// + /// Specifies runtime fields which exist only as part of the query. + /// + [DataMember(Name = "runtime_mappings")] + IRuntimeFields RuntimeFields { get; set; } + + /// + /// For basic queries, the maximum number of matching events to return. Defaults to 10. + /// + [DataMember(Name = "size")] + float? Size { get; set; } + + /// + /// To specify a tiebreaker field, use the parameter. If you use the ECS, + /// we recommend using event.sequence as the tiebreaker field. + /// + [DataMember(Name = "tiebreaker_field")] + Field TiebreakerField { get; set; } + + /// + /// The EQL search API uses the @timestamp field from the ECS by default. To specify a different field, + /// set . + /// + [DataMember(Name = "timestamp_field")] + Field TimestampField { get; set; } + } + + [ReadAs(typeof(EqlSearchRequest<>))] + [InterfaceDataContract] + // ReSharper disable once UnusedTypeParameter + public partial interface IEqlSearchRequest { } + + public partial class EqlSearchRequest + { + /// + public Field EventCategoryField { get; set; } + /// + public int? FetchSize { get; set; } + /// + public Fields Fields { get; set; } + /// + public QueryContainer Filter { get; set; } + /// + public string Query { get; set; } + /// + public EqlResultPosition? ResultPosition { get; set; } + /// + public IRuntimeFields RuntimeFields { get; set; } + /// + public float? Size { get; set; } + /// + public Field TiebreakerField { get; set; } + /// + public Field TimestampField { get; set; } + + Type ITypedSearchRequest.ClrType => null; + } + + [DataContract] + public partial class EqlSearchRequest + { + Type ITypedSearchRequest.ClrType => typeof(TInferDocument); + } + + public partial class EqlSearchDescriptor where TInferDocument : class + { + Type ITypedSearchRequest.ClrType => typeof(TInferDocument); + + /// + Field IEqlSearchRequest.EventCategoryField { get; set; } + + /// + int? IEqlSearchRequest.FetchSize { get; set; } + + /// + Fields IEqlSearchRequest.Fields { get; set; } + + /// + QueryContainer IEqlSearchRequest.Filter { get; set; } + + /// + string IEqlSearchRequest.Query { get; set; } + + /// + EqlResultPosition? IEqlSearchRequest.ResultPosition { get; set; } + + /// + IRuntimeFields IEqlSearchRequest.RuntimeFields { get; set; } + + /// + float? IEqlSearchRequest.Size { get; set; } + + /// + Field IEqlSearchRequest.TiebreakerField { get; set; } + + /// + Field IEqlSearchRequest.TimestampField { get; set; } + + /// + public EqlSearchDescriptor EventCategoryField(Field eventCategoryField) => Assign(eventCategoryField, (a, v) => a.EventCategoryField = v); + + /// + public EqlSearchDescriptor EventCategoryField(Expression> objectPath) => + Assign(objectPath, (a, v) => a.EventCategoryField = v); + + /// + public EqlSearchDescriptor FetchSize(int? fetchSize) => Assign(fetchSize, (a, v) => a.FetchSize = v); + + /// + public EqlSearchDescriptor Fields(Func, IPromise> fields) => + Assign(fields, (a, v) => a.Fields = v?.Invoke(new FieldsDescriptor())?.Value); + + /// + public EqlSearchDescriptor Fields(Fields fields) => Assign(fields, (a, v) => a.Fields = v); + + /// + public EqlSearchDescriptor Filter(Func, QueryContainer> filter) => + Assign(filter, (a, v) => a.Filter = v?.Invoke(new QueryContainerDescriptor())); + + /// + public EqlSearchDescriptor Query(string query) => Assign(query, (a, v) => a.Query = v); + + /// + public EqlSearchDescriptor ResultPosition(EqlResultPosition? resultPosition) => Assign(resultPosition, (a, v) => a.ResultPosition = v); + + /// + public EqlSearchDescriptor RuntimeFields(Func> runtimeFieldsSelector) => + Assign(runtimeFieldsSelector, (a, v) => a.RuntimeFields = v?.Invoke(new RuntimeFieldsDescriptor())?.Value); + + /// + public EqlSearchDescriptor Size(float? size) => Assign(size, (a, v) => a.Size = v); + + /// + public EqlSearchDescriptor TiebreakerField(Field tiebreakerField) => Assign(tiebreakerField, (a, v) => a.TiebreakerField = v); + + /// + public EqlSearchDescriptor TiebreakerField(Expression> objectPath) => + Assign(objectPath, (a, v) => a.TiebreakerField = v); + + /// + public EqlSearchDescriptor TimestampField(Field timestampField) => Assign(timestampField, (a, v) => a.TimestampField = v); + + /// + public EqlSearchDescriptor TimestampField(Expression> objectPath) => + Assign(objectPath, (a, v) => a.TimestampField = v); + } +} diff --git a/src/Nest/XPack/Eql/Search/EqlSearchResponse.cs b/src/Nest/XPack/Eql/Search/EqlSearchResponse.cs new file mode 100644 index 00000000000..607d2aabad7 --- /dev/null +++ b/src/Nest/XPack/Eql/Search/EqlSearchResponse.cs @@ -0,0 +1,94 @@ +/* + * 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.Collections.Generic; +using System.Runtime.Serialization; +using Elasticsearch.Net; + +namespace Nest +{ + /// + /// A response to an EQL search request. + /// + /// The event type. + public class EqlSearchResponse : ResponseBase where TDocument : class + { + private IReadOnlyCollection> _events; + private IReadOnlyCollection> _sequences; + + /// + /// Access the events returned by the search. + /// + [IgnoreDataMember] + public IReadOnlyCollection> Events => + _events ??= EqlHitsMetadata?.Events ?? EmptyReadOnly>.Collection; + + /// + /// Access the sequences returned by the search. + /// + [IgnoreDataMember] + public IReadOnlyCollection> Sequences => + _sequences ??= EqlHitsMetadata?.Sequences ?? EmptyReadOnly>.Collection; + + /// + /// Gets the collection of events that matched the search. + /// + /// + /// The hits. + /// + [DataMember(Name = "hits")] + public EqlHitsMetadata EqlHitsMetadata { get; internal set; } + + /// + /// Identifier for the search. + /// + [DataMember(Name = "id")] + public Id Id { get; internal set; } + + /// + /// If true, the response does not contain complete search results. + /// + [DataMember(Name = "is_partial")] + public bool? IsPartial { get; internal set; } + + /// + /// If true, the search request is still executing. + /// + [DataMember(Name = "is_running")] + public bool? IsRunning { get; internal set; } + + /// + /// Milliseconds it took Elasticsearch to execute the request. + /// + [DataMember(Name = "took")] + public int Took { get; internal set; } + + /// + /// If true, the request timed out before completion. + /// + [DataMember(Name = "timed_out")] + public bool? TimedOut { get; internal set; } + + /// + /// The total number of hits. + /// + [IgnoreDataMember] + public long Total => EqlHitsMetadata?.Total.Value ?? -1; + } +} diff --git a/tests/Tests.Core/ManagedElasticsearch/Clusters/TimeSeriesCluster.cs b/tests/Tests.Core/ManagedElasticsearch/Clusters/TimeSeriesCluster.cs index 267a2368938..772a399bf62 100644 --- a/tests/Tests.Core/ManagedElasticsearch/Clusters/TimeSeriesCluster.cs +++ b/tests/Tests.Core/ManagedElasticsearch/Clusters/TimeSeriesCluster.cs @@ -28,20 +28,28 @@ namespace Tests.Core.ManagedElasticsearch.Clusters public class TimeSeriesCluster : XPackCluster { protected override void SeedNode() => new TimeSeriesSeeder(Client).SeedNode(); + + protected override ConnectionSettings ConnectionSettings(ConnectionSettings s) + { + s.DefaultMappingFor(m => m.IndexName(TimeSeriesSeeder.IndicesWildCard)); + return base.ConnectionSettings(s); + } } public class TimeSeriesSeeder { - public static readonly string IndicesWildCard = "logs-*"; + public static readonly string IndicesWildCard = "customlogs-*"; private readonly IElasticClient _client; public TimeSeriesSeeder(IElasticClient client) => _client = client; public void SeedNode() { - _client.Indices.PutTemplate("logs-template", p => p + _client.Indices.PutTemplate("customlogs-template", p => p .Create() - .Map(m => m.AutoMap()) + .Map(m => m + .AutoMap() + .Properties(p => p.Date(d => d.Name(n => n.Timestamp)))) .IndexPatterns(IndicesWildCard) .Settings(s => s .NumberOfShards(1) @@ -49,17 +57,17 @@ public void SeedNode() ) ); - var logs = Log.Generator.GenerateLazy(200_000); + var logs = Log.Generator.GenerateLazy(100_000); var sw = Stopwatch.StartNew(); var dropped = new List(); var bulkAll = _client.BulkAll(new BulkAllRequest(logs) { Size = 10_000, - MaxDegreeOfParallelism = 8, + MaxDegreeOfParallelism = 10, RefreshOnCompleted = true, RefreshIndices = IndicesWildCard, DroppedDocumentCallback = (d, l) => dropped.Add(l), - BufferToBulk = (b, buffer) => b.IndexMany(buffer, (i, l) => i.Index($"logs-{l.Timestamp:yyyy-MM-dd}")) + BufferToBulk = (b, buffer) => b.IndexMany(buffer, (i, l) => i.Index($"customlogs-{l.Timestamp:yyyy-MM-dd}")) }); bulkAll.Wait(TimeSpan.FromMinutes(1), delegate { }); Console.WriteLine($"Completed in {sw.Elapsed} with {dropped.Count} dropped logs"); diff --git a/tests/Tests.Domain/Extensions/ConnectionSettingsExtensions.cs b/tests/Tests.Domain/Extensions/ConnectionSettingsExtensions.cs index 6d88245c898..902957db782 100644 --- a/tests/Tests.Domain/Extensions/ConnectionSettingsExtensions.cs +++ b/tests/Tests.Domain/Extensions/ConnectionSettingsExtensions.cs @@ -51,6 +51,9 @@ public static ConnectionSettings ApplyDomainSettings(this ConnectionSettings set ) .DefaultMappingFor(map => map .IndexName("shapes") + ) + .DefaultMappingFor(map => map + .IndexName("customlogs-*") ); } } diff --git a/tests/Tests.Domain/Log.cs b/tests/Tests.Domain/Log.cs index 18251c90408..90aa786e902 100644 --- a/tests/Tests.Domain/Log.cs +++ b/tests/Tests.Domain/Log.cs @@ -52,6 +52,7 @@ public class Log public static readonly string[] Sections = Words.Where(w => w.Length > 3).Take(10).ToArray(); + public static readonly string[] EventCategories = { "info", "error", "warn" }; public string Body { get; set; } @@ -69,7 +70,8 @@ public class Log .RuleFor(m => m.Section, m => m.PickRandom(Sections)) .RuleFor(m => m.Load, m => m.Random.Double(100, 500)) .RuleFor(m => m.NetIn, m => m.Random.Double(1000, 10000)) - .RuleFor(m => m.NetOut, m => m.Random.Double(1000, 10000)); + .RuleFor(m => m.NetOut, m => m.Random.Double(1000, 10000)) + .RuleFor(m => m.Event, m => new LogEvent(m.PickRandom(EventCategories)){ Sequence = m.Random.Int(0, 10)}); public double Load { get; set; } public double NetIn { get; set; } @@ -82,6 +84,7 @@ public class Log [Keyword] public string User { get; set; } [Keyword] public string UserAgent { get; set; } public double Voltage { get; set; } + public LogEvent Event { get; set; } private static string GetMessageText() { @@ -93,5 +96,13 @@ private static string GetMessageText() return sb.ToString().TrimEnd(); } + + public class LogEvent + { + public LogEvent(string category) => Category = category; + + public string Category { get; set; } + public int Sequence { get; set; } + } } } diff --git a/tests/Tests/ClientConcepts/Troubleshooting/AuditTrail.doc.cs b/tests/Tests/ClientConcepts/Troubleshooting/AuditTrail.doc.cs index 7b6208d30c6..bb27aa59b54 100644 --- a/tests/Tests/ClientConcepts/Troubleshooting/AuditTrail.doc.cs +++ b/tests/Tests/ClientConcepts/Troubleshooting/AuditTrail.doc.cs @@ -47,10 +47,7 @@ public class AuditTrail : IClusterFixture { private readonly ReadOnlyCluster _cluster; - public AuditTrail(ReadOnlyCluster cluster) - { - _cluster = cluster; - } + public AuditTrail(ReadOnlyCluster cluster) => _cluster = cluster; [I] public void AvailableOnResponse() { diff --git a/tests/Tests/XPack/Eql/Search/EqlSearchApiTests.cs b/tests/Tests/XPack/Eql/Search/EqlSearchApiTests.cs new file mode 100644 index 00000000000..40cc5b4548f --- /dev/null +++ b/tests/Tests/XPack/Eql/Search/EqlSearchApiTests.cs @@ -0,0 +1,201 @@ +/* + * 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.Linq; +using Elastic.Elasticsearch.Xunit.XunitPlumbing; +using Elasticsearch.Net; +using FluentAssertions; +using Nest; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Domain; +using Tests.Framework.EndpointTests; +using Tests.Framework.EndpointTests.TestState; + +namespace Tests.XPack.Eql.Search +{ + [SkipVersion("<7.11.0", "EQL went GA in 7.11.0")] + public class EqlSearchApiTests + : ApiIntegrationTestBase, IEqlSearchRequest, EqlSearchDescriptor, EqlSearchRequest> + { + private const string ScriptValue = "emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))"; + private static readonly string EqlQuery = $"info where section == \"{Log.Sections.First()}\""; + + public EqlSearchApiTests(TimeSeriesCluster cluster, EndpointUsage usage) : base(cluster, usage) { } + + protected override bool ExpectIsValid => true; + + protected override object ExpectJson => new + { + event_category_field = "event.category", + fields = new[] { "tag", "dayOfWeek" }, + filter = new + { + range = new + { + timestamp = new + { + gt = "2015-06-06T12:01:02.123" + } + } + }, + query = EqlQuery, + result_position = "tail", + runtime_mappings = new + { + dayOfWeek = new + { + script = new + { + source = ScriptValue + }, + type = "keyword" + } + }, + size = 10.0, + tiebreaker_field = "netIn", + timestamp_field = "timestamp" + }; + + protected override int ExpectStatusCode => 200; + + protected override Func, IEqlSearchRequest> Fluent => s => s + .EventCategoryField(f => f.Event.Category) + .Fields(f => f.Field(fld => fld.Tag).Field("dayOfWeek")) + .Filter(f => f.DateRange(r => r.Field(fld => fld.Timestamp).GreaterThan(Domain.Helpers.TestValueHelper.FixedDate))) + .Query(EqlQuery) + .ResultPosition(EqlResultPosition.Tail) + .RuntimeFields(rtf => rtf.RuntimeField("dayOfWeek", FieldType.Keyword, rf => rf + .Script(ScriptValue))) + .Size(10) + .TiebreakerField(t => t.NetIn) + .TimestampField(Infer.Field(f => f.Timestamp)); + + protected override HttpMethod HttpMethod => HttpMethod.POST; + + protected override EqlSearchRequest Initializer => new EqlSearchRequest + { + EventCategoryField = Infer.Field(f => f.Event.Category), + Fields = new[] { Infer.Field(fld => fld.Tag), "dayOfWeek" }, + Filter = new DateRangeQuery + { + Field = "timestamp", + GreaterThan = Domain.Helpers.TestValueHelper.FixedDate + }, + Query = EqlQuery, + ResultPosition = EqlResultPosition.Tail, + RuntimeFields = new RuntimeFields + { + { "dayOfWeek", new RuntimeField { Type = FieldType.Keyword, Script = new InlineScript(ScriptValue) }} + }, + Size = 10, + TiebreakerField = Infer.Field(f => f.NetIn), + TimestampField = Infer.Field(f => f.Timestamp) + }; + + protected override string UrlPath => "/customlogs-%2A/_eql/search"; + + protected override LazyResponses ClientUsage() => Calls( + (c, f) => c.Eql.Search(f), + (c, f) => c.Eql.SearchAsync(f), + (c, r) => c.Eql.Search(r), + (c, r) => c.Eql.SearchAsync(r) + ); + + protected override void ExpectResponse(EqlSearchResponse response) + { + response.IsValid.Should().BeTrue(); + response.IsPartial.Should().BeFalse(); + response.IsRunning.Should().BeFalse(); + response.Took.Should().BeGreaterOrEqualTo(0); + response.TimedOut.Should().BeFalse(); + response.Events.Count.Should().Be(10); //default + response.EqlHitsMetadata.Total.Value.Should().Be(10); + response.Total.Should().Be(10); + + var firstEvent = response.Events.First(); + firstEvent.Index.Should().StartWith("customlogs-"); + firstEvent.Id.Should().NotBeNullOrEmpty(); + firstEvent.Source.Event.Category.Should().Be("info"); + firstEvent.Fields.Should().HaveCount(2); + firstEvent.Fields.ValuesOf("dayOfWeek").Should().ContainSingle().Which.Should().NotBeNullOrEmpty(); + firstEvent.Fields.ValuesOf("tag").Should().ContainSingle().Which.Should().NotBeNullOrEmpty(); + } + } + + [SkipVersion("<7.11.0", "EQL went GA in 7.11.0")] + public class EqlSearchWithSequenceApiTests + : ApiIntegrationTestBase, IEqlSearchRequest, EqlSearchDescriptor, EqlSearchRequest> + { + private const string EqlQuery = "sequence [info where temperature > -10][error where true]"; + + public EqlSearchWithSequenceApiTests(TimeSeriesCluster cluster, EndpointUsage usage) : base(cluster, usage) { } + + protected override bool ExpectIsValid => true; + + protected override object ExpectJson => new + { + fetch_size = 5, + query = EqlQuery, + timestamp_field = "timestamp" + }; + + protected override int ExpectStatusCode => 200; + + protected override Func, IEqlSearchRequest> Fluent => s => s + .FetchSize(5) + .Query(EqlQuery) + .TimestampField(Infer.Field(f => f.Timestamp)); + + protected override HttpMethod HttpMethod => HttpMethod.POST; + + protected override EqlSearchRequest Initializer => new EqlSearchRequest + { + FetchSize = 5, + Query = EqlQuery, + TimestampField = Infer.Field(f => f.Timestamp) + }; + + protected override string UrlPath => "/customlogs-%2A/_eql/search"; + + protected override LazyResponses ClientUsage() => Calls( + (c, f) => c.Eql.Search(f), + (c, f) => c.Eql.SearchAsync(f), + (c, r) => c.Eql.Search(r), + (c, r) => c.Eql.SearchAsync(r) + ); + + protected override void ExpectResponse(EqlSearchResponse response) + { + response.IsValid.Should().BeTrue(); + response.IsPartial.Should().BeFalse(); + response.IsRunning.Should().BeFalse(); + response.Took.Should().BeGreaterOrEqualTo(0); + response.TimedOut.Should().BeFalse(); + response.Sequences.Count.Should().Be(10); + response.EqlHitsMetadata.Total.Value.Should().Be(10); + response.Total.Should().Be(10); + + var sequence = response.Sequences.First(); + sequence.Events.Count.Should().Be(2); + sequence.Events.First().Source.Event.Category.Should().Be("info"); + sequence.Events.Last().Source.Event.Category.Should().Be("error"); + } + } +} diff --git a/tests/Tests/XPack/Eql/Search/EqlSearchUrlTests.cs b/tests/Tests/XPack/Eql/Search/EqlSearchUrlTests.cs new file mode 100644 index 00000000000..74b2bde1d36 --- /dev/null +++ b/tests/Tests/XPack/Eql/Search/EqlSearchUrlTests.cs @@ -0,0 +1,62 @@ +/* + * 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.Threading.Tasks; +using Elastic.Elasticsearch.Xunit.XunitPlumbing; +using Nest; +using Tests.Domain; +using Tests.Framework.EndpointTests; +using static Tests.Framework.EndpointTests.UrlTester; + +namespace Tests.XPack.Eql.Search +{ + public class EqlSearchUrlTests + { + [U] public async Task Urls() + { + var hardcoded = "hardcoded"; + + await POST("/customlogs-%2A/_eql/search") + .Fluent(c => c.Eql.Search()) + .Request(c => c.Eql.Search(new EqlSearchRequest("customlogs-*"))) + .FluentAsync(c => c.Eql.SearchAsync()) + .RequestAsync(c => c.Eql.SearchAsync(new EqlSearchRequest("customlogs-*"))); + + await POST("/customlogs-%2A/_eql/search") + .Fluent(c => c.Eql.Search(s => s)) + .Request(c => c.Eql.Search(new EqlSearchRequest(typeof(Log)))) + .FluentAsync(c => c.Eql.SearchAsync(s => s)) + .RequestAsync(c => c.Eql.SearchAsync(new EqlSearchRequest(typeof(Log)))); + + await POST("/hardcoded/_eql/search") + .Fluent(c => c.Eql.Search(s => s.Index(hardcoded))) + .Request(c => c.Eql.Search(new EqlSearchRequest(hardcoded))) + .Request(c => c.Eql.Search(new EqlSearchRequest(hardcoded))) + .FluentAsync(c => c.Eql.SearchAsync(s => s.Index(hardcoded))) + .RequestAsync(c => c.Eql.SearchAsync(new EqlSearchRequest(hardcoded))) + .RequestAsync(c => c.Eql.SearchAsync(new EqlSearchRequest(hardcoded))); + + await POST("/_all/_eql/search") + .Fluent(c => c.Eql.Search(s => s.AllIndices())) + .Request(c => c.Eql.Search(new EqlSearchRequest(Nest.Indices.All))) + .FluentAsync(c => c.Eql.SearchAsync(s => s.AllIndices())) + .RequestAsync(c => c.Eql.SearchAsync(new EqlSearchRequest(Nest.Indices.All))); + } + } +} From 1771dec36d3069c4b5b56812653856b4592ed074 Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Tue, 4 May 2021 07:11:37 +0100 Subject: [PATCH 2/5] Update code-gen --- .../RequestParameters.Eql.cs | 2 +- .../ElasticLowLevelClient.Eql.cs | 8 +- src/Nest/Descriptors.AsyncSearch.cs | 5 +- src/Nest/Descriptors.Cat.cs | 3 +- src/Nest/Descriptors.Cluster.cs | 3 +- .../Descriptors.CrossClusterReplication.cs | 1 - src/Nest/Descriptors.DanglingIndices.cs | 1 - src/Nest/Descriptors.Enrich.cs | 1 - src/Nest/Descriptors.Eql.cs | 86 ++++++++++++ src/Nest/Descriptors.Graph.cs | 1 - .../Descriptors.IndexLifecycleManagement.cs | 1 - src/Nest/Descriptors.Indices.cs | 14 +- src/Nest/Descriptors.Ingest.cs | 3 +- src/Nest/Descriptors.License.cs | 4 +- src/Nest/Descriptors.MachineLearning.cs | 34 +++-- src/Nest/Descriptors.Migration.cs | 1 - src/Nest/Descriptors.NoNamespace.cs | 3 +- src/Nest/Descriptors.Nodes.cs | 11 +- src/Nest/Descriptors.Rollup.cs | 1 - src/Nest/Descriptors.Security.cs | 1 - src/Nest/Descriptors.Snapshot.cs | 5 +- ...Descriptors.SnapshotLifecycleManagement.cs | 1 - src/Nest/Descriptors.Sql.cs | 1 - src/Nest/Descriptors.Tasks.cs | 1 - src/Nest/Descriptors.Transform.cs | 1 - src/Nest/Descriptors.Watcher.cs | 1 - src/Nest/Descriptors.XPack.cs | 4 +- src/Nest/Descriptors.cs | 19 --- src/Nest/ElasticClient.AsyncSearch.cs | 1 - src/Nest/ElasticClient.Cat.cs | 1 - src/Nest/ElasticClient.Cluster.cs | 9 +- .../ElasticClient.CrossClusterReplication.cs | 1 - src/Nest/ElasticClient.DanglingIndices.cs | 1 - src/Nest/ElasticClient.Enrich.cs | 1 - src/Nest/ElasticClient.Eql.cs | 100 ++++++++++++++ src/Nest/ElasticClient.Graph.cs | 1 - .../ElasticClient.IndexLifecycleManagement.cs | 1 - src/Nest/ElasticClient.Indices.cs | 1 - src/Nest/ElasticClient.Ingest.cs | 1 - src/Nest/ElasticClient.License.cs | 1 - src/Nest/ElasticClient.MachineLearning.cs | 17 ++- src/Nest/ElasticClient.Migration.cs | 1 - src/Nest/ElasticClient.NoNamespace.cs | 10 +- src/Nest/ElasticClient.Nodes.cs | 1 - src/Nest/ElasticClient.Rollup.cs | 1 - src/Nest/ElasticClient.Security.cs | 1 - src/Nest/ElasticClient.Snapshot.cs | 1 - ...asticClient.SnapshotLifecycleManagement.cs | 1 - src/Nest/ElasticClient.Sql.cs | 1 - src/Nest/ElasticClient.Tasks.cs | 1 - src/Nest/ElasticClient.Transform.cs | 1 - src/Nest/ElasticClient.Watcher.cs | 1 - src/Nest/ElasticClient.XPack.cs | 1 - src/Nest/IElasticClient.Generated.cs | 8 +- src/Nest/Requests.AsyncSearch.cs | 3 +- src/Nest/Requests.Cat.cs | 8 +- src/Nest/Requests.Cluster.cs | 3 +- src/Nest/Requests.CrossClusterReplication.cs | 1 - src/Nest/Requests.DanglingIndices.cs | 1 - src/Nest/Requests.Enrich.cs | 1 - src/Nest/Requests.Eql.cs | 129 ++++++++++++++++++ src/Nest/Requests.Graph.cs | 1 - src/Nest/Requests.IndexLifecycleManagement.cs | 1 - src/Nest/Requests.Indices.cs | 1 - src/Nest/Requests.Ingest.cs | 8 +- src/Nest/Requests.License.cs | 1 - src/Nest/Requests.MachineLearning.cs | 14 +- src/Nest/Requests.Migration.cs | 1 - src/Nest/Requests.NoNamespace.cs | 8 +- src/Nest/Requests.Nodes.cs | 8 +- src/Nest/Requests.Rollup.cs | 1 - src/Nest/Requests.Security.cs | 1 - src/Nest/Requests.Snapshot.cs | 10 +- .../Requests.SnapshotLifecycleManagement.cs | 1 - src/Nest/Requests.Sql.cs | 1 - src/Nest/Requests.Tasks.cs | 1 - src/Nest/Requests.Transform.cs | 1 - src/Nest/Requests.Watcher.cs | 1 - src/Nest/Requests.XPack.cs | 1 - src/Nest/Requests.cs | 6 +- .../_Generated/ApiUrlsLookup.generated.cs | 1 + 81 files changed, 446 insertions(+), 150 deletions(-) create mode 100644 src/Nest/Descriptors.Eql.cs create mode 100644 src/Nest/ElasticClient.Eql.cs create mode 100644 src/Nest/Requests.Eql.cs diff --git a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Eql.cs b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Eql.cs index 1d6d33db284..fbad22711fc 100644 --- a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Eql.cs +++ b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Eql.cs @@ -72,7 +72,7 @@ public class GetStatusRequestParameters : RequestParametersRequest options for Search https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html - public class SearchRequestParameters : RequestParameters + public class EqlSearchRequestParameters : RequestParameters { ///Update the time interval in which the results (partial or final) for this search will be available public TimeSpan KeepAlive diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.Eql.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.Eql.cs index 74fa120dbae..124f1baeed8 100644 --- a/src/Elasticsearch.Net/ElasticLowLevelClient.Eql.cs +++ b/src/Elasticsearch.Net/ElasticLowLevelClient.Eql.cs @@ -96,17 +96,17 @@ public TResponse GetStatus(string id, GetStatusRequestParameters requ public Task GetStatusAsync(string id, GetStatusRequestParameters requestParameters = null, CancellationToken ctx = default) where TResponse : class, ITransportResponse, new() => DoRequestAsync(GET, Url($"_eql/search/status/{id:id}"), ctx, null, RequestParams(requestParameters)); ///POST on /{index}/_eql/search https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html - ///The name of the index to scope the operation + ///A comma-separated list of index names to search; use the special string `_all` or Indices.All to perform the operation on all indices ///Eql request body. Use the `query` to limit the query scope. ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Search(string index, PostData body, SearchRequestParameters requestParameters = null) + public TResponse Search(string index, PostData body, EqlSearchRequestParameters requestParameters = null) where TResponse : class, ITransportResponse, new() => DoRequest(POST, Url($"{index:index}/_eql/search"), body, RequestParams(requestParameters)); ///POST on /{index}/_eql/search https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html - ///The name of the index to scope the operation + ///A comma-separated list of index names to search; use the special string `_all` or Indices.All to perform the operation on all indices ///Eql request body. Use the `query` to limit the query scope. ///Request specific configuration such as querystring parameters & request specific connection settings. [MapsApi("eql.search", "index, body")] - public Task SearchAsync(string index, PostData body, SearchRequestParameters requestParameters = null, CancellationToken ctx = default) + public Task SearchAsync(string index, PostData body, EqlSearchRequestParameters requestParameters = null, CancellationToken ctx = default) where TResponse : class, ITransportResponse, new() => DoRequestAsync(POST, Url($"{index:index}/_eql/search"), ctx, body, RequestParams(requestParameters)); } } \ No newline at end of file diff --git a/src/Nest/Descriptors.AsyncSearch.cs b/src/Nest/Descriptors.AsyncSearch.cs index a74d02c3e32..dac59ac84e8 100644 --- a/src/Nest/Descriptors.AsyncSearch.cs +++ b/src/Nest/Descriptors.AsyncSearch.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -40,8 +39,8 @@ using System.Text; using System.Linq.Expressions; using Elastic.Transport; -using Nest.Utf8Json; using Elasticsearch.Net; +using Nest.Utf8Json; using Elasticsearch.Net.Specification.AsyncSearchApi; // ReSharper disable RedundantBaseConstructorCall @@ -215,4 +214,4 @@ public AsyncSearchSubmitDescriptor Index() ///Specify the time that the request should block waiting for the final response public AsyncSearchSubmitDescriptor WaitForCompletionTimeout(Time waitforcompletiontimeout) => Qs("wait_for_completion_timeout", waitforcompletiontimeout); } -} +} \ No newline at end of file diff --git a/src/Nest/Descriptors.Cat.cs b/src/Nest/Descriptors.Cat.cs index 702dd06209b..76aefd7322e 100644 --- a/src/Nest/Descriptors.Cat.cs +++ b/src/Nest/Descriptors.Cat.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -518,6 +517,8 @@ public partial class CatNodesDescriptor : RequestDescriptorBase Qs("h", headers); ///Return help information public CatNodesDescriptor Help(bool? help = true) => Qs("help", help); + ///If set to true segment stats will include stats for segments that are not currently loaded into memory + public CatNodesDescriptor IncludeUnloadedSegments(bool? includeunloadedsegments = true) => Qs("include_unloaded_segments", includeunloadedsegments); ///Explicit operation timeout for connection to master node public CatNodesDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); ///Comma-separated list of column names or column aliases to sort by diff --git a/src/Nest/Descriptors.Cluster.cs b/src/Nest/Descriptors.Cluster.cs index 5728797d81e..e679c795318 100644 --- a/src/Nest/Descriptors.Cluster.cs +++ b/src/Nest/Descriptors.Cluster.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -76,7 +75,7 @@ public partial class DeleteVotingConfigExclusionsDescriptor : RequestDescriptorB public DeleteVotingConfigExclusionsDescriptor WaitForRemoval(bool? waitforremoval = true) => Qs("wait_for_removal", waitforremoval); } - ///Descriptor for GetSettings https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html + ///Descriptor for GetSettings https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html public partial class ClusterGetSettingsDescriptor : RequestDescriptorBase, IClusterGetSettingsRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterGetSettings; diff --git a/src/Nest/Descriptors.CrossClusterReplication.cs b/src/Nest/Descriptors.CrossClusterReplication.cs index 32203562f19..8a003034eb0 100644 --- a/src/Nest/Descriptors.CrossClusterReplication.cs +++ b/src/Nest/Descriptors.CrossClusterReplication.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.DanglingIndices.cs b/src/Nest/Descriptors.DanglingIndices.cs index 8729bdb5ed3..c18f4bd73e8 100644 --- a/src/Nest/Descriptors.DanglingIndices.cs +++ b/src/Nest/Descriptors.DanglingIndices.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.Enrich.cs b/src/Nest/Descriptors.Enrich.cs index 564d7d882c6..3a145d2b98d 100644 --- a/src/Nest/Descriptors.Enrich.cs +++ b/src/Nest/Descriptors.Enrich.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.Eql.cs b/src/Nest/Descriptors.Eql.cs new file mode 100644 index 00000000000..0a15c620deb --- /dev/null +++ b/src/Nest/Descriptors.Eql.cs @@ -0,0 +1,86 @@ +/* + * 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. + */ +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ----------------------------------------------- +// +// This file is automatically generated +// Please do not edit these files manually +// Run the following in the root of the repos: +// +// *NIX : ./build.sh codegen +// Windows : build.bat codegen +// +// ----------------------------------------------- +// ReSharper disable RedundantUsingDirective +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Linq.Expressions; +using Elastic.Transport; +using Elasticsearch.Net; +using Nest.Utf8Json; +using Elasticsearch.Net.Specification.EqlApi; + +// ReSharper disable RedundantBaseConstructorCall +// ReSharper disable UnusedTypeParameter +// ReSharper disable PartialMethodWithSinglePart +// ReSharper disable RedundantNameQualifier +namespace Nest +{ + ///Descriptor for Search https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html + public partial class EqlSearchDescriptor : RequestDescriptorBase, EqlSearchRequestParameters, IEqlSearchRequest>, IEqlSearchRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.EqlSearch; + protected override HttpMethod HttpMethod => HttpMethod.POST; + protected override bool SupportsBody => true; + ////{index}/_eql/search + ///this parameter is required + public EqlSearchDescriptor(Indices index): base(r => r.Required("index", index)) + { + } + + ////{index}/_eql/search + public EqlSearchDescriptor(): this(typeof(TInferDocument)) + { + } + + // values part of the url path + Indices IEqlSearchRequest.Index => Self.RouteValues.Get("index"); + ///A comma-separated list of index names to search; use the special string `_all` or Indices.All to perform the operation on all indices + public EqlSearchDescriptor Index(Indices index) => Assign(index, (a, v) => a.RouteValues.Required("index", v)); + ///a shortcut into calling Index(typeof(TOther)) + public EqlSearchDescriptor Index() + where TOther : class => Assign(typeof(TOther), (a, v) => a.RouteValues.Required("index", (Indices)v)); + ///A shortcut into calling Index(Indices.All) + public EqlSearchDescriptor AllIndices() => Index(Indices.All); + // Request parameters + ///Update the time interval in which the results (partial or final) for this search will be available + public EqlSearchDescriptor KeepAlive(Time keepalive) => Qs("keep_alive", keepalive); + ///Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) + public EqlSearchDescriptor KeepOnCompletion(bool? keeponcompletion = true) => Qs("keep_on_completion", keeponcompletion); + ///Specify the time that the request should block waiting for the final response + public EqlSearchDescriptor WaitForCompletionTimeout(Time waitforcompletiontimeout) => Qs("wait_for_completion_timeout", waitforcompletiontimeout); + } +} \ No newline at end of file diff --git a/src/Nest/Descriptors.Graph.cs b/src/Nest/Descriptors.Graph.cs index 8b50c796ed7..1fe93dda755 100644 --- a/src/Nest/Descriptors.Graph.cs +++ b/src/Nest/Descriptors.Graph.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.IndexLifecycleManagement.cs b/src/Nest/Descriptors.IndexLifecycleManagement.cs index b9a9dbc65db..bbf61fe99c9 100644 --- a/src/Nest/Descriptors.IndexLifecycleManagement.cs +++ b/src/Nest/Descriptors.IndexLifecycleManagement.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.Indices.cs b/src/Nest/Descriptors.Indices.cs index 83a4bca6ec6..a42118628bc 100644 --- a/src/Nest/Descriptors.Indices.cs +++ b/src/Nest/Descriptors.Indices.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -893,7 +892,8 @@ public GetMappingDescriptor Index() public GetMappingDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards); ///Whether specified concrete indices should be ignored when unavailable (missing or closed) public GetMappingDescriptor IgnoreUnavailable(bool? ignoreunavailable = true) => Qs("ignore_unavailable", ignoreunavailable); - ///Return local information, do not retrieve the state from master node (default: false) [Obsolete("Scheduled to be removed in 7.0, Deprecated as of: 7.8.0, reason: This parameter is a no-op and field mappings are always retrieved locally.")] + ///Return local information, do not retrieve the state from master node (default: false) + [Obsolete("Scheduled to be removed in 8.0, Deprecated as of: 7.8.0, reason: This parameter is a no-op and field mappings are always retrieved locally.")] public GetMappingDescriptor Local(bool? local = true) => Qs("local", local); ///Specify timeout for connection to master public GetMappingDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); @@ -992,9 +992,7 @@ public GetIndexTemplateDescriptor(Names name): base(r => r.Optional("name", name public partial class MigrateToDataStreamDescriptor : RequestDescriptorBase, IMigrateToDataStreamRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.IndicesMigrateToDataStream; - protected override HttpMethod HttpMethod => HttpMethod.POST; - protected override bool SupportsBody => false; ////_data_stream/_migrate/{name} ///this parameter is required @@ -1584,16 +1582,16 @@ public IndicesStatsDescriptor Index() ///A shortcut into calling Index(Indices.All) public IndicesStatsDescriptor AllIndices() => Index(Indices.All); // Request parameters - ///A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) + ///A comma-separated list of fields for the `completion` index metric (supports wildcards) public IndicesStatsDescriptor CompletionFields(Fields completionfields) => Qs("completion_fields", completionfields); - ///A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) + ///A comma-separated list of fields for the `completion` index metric (supports wildcards) public IndicesStatsDescriptor CompletionFields(params Expression>[] fields) where T : class => Qs("completion_fields", fields?.Select(e => (Field)e)); ///Whether to expand wildcard expression to concrete indices that are open, closed or both. public IndicesStatsDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards); - ///A comma-separated list of fields for `fielddata` index metric (supports wildcards) + ///A comma-separated list of fields for the `fielddata` index metric (supports wildcards) public IndicesStatsDescriptor FielddataFields(Fields fielddatafields) => Qs("fielddata_fields", fielddatafields); - ///A comma-separated list of fields for `fielddata` index metric (supports wildcards) + ///A comma-separated list of fields for the `fielddata` index metric (supports wildcards) public IndicesStatsDescriptor FielddataFields(params Expression>[] fields) where T : class => Qs("fielddata_fields", fields?.Select(e => (Field)e)); ///A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) diff --git a/src/Nest/Descriptors.Ingest.cs b/src/Nest/Descriptors.Ingest.cs index 94ddc9b0a89..2cf7b1e769d 100644 --- a/src/Nest/Descriptors.Ingest.cs +++ b/src/Nest/Descriptors.Ingest.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -101,6 +100,8 @@ public GetPipelineDescriptor(Id id): base(r => r.Optional("id", id)) // Request parameters ///Explicit operation timeout for connection to master node public GetPipelineDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); + ///Return pipelines without their definitions (default: false) + public GetPipelineDescriptor Summary(bool? summary = true) => Qs("summary", summary); } ///Descriptor for GrokProcessorPatterns https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get diff --git a/src/Nest/Descriptors.License.cs b/src/Nest/Descriptors.License.cs index 138a81a133b..3f06de90461 100644 --- a/src/Nest/Descriptors.License.cs +++ b/src/Nest/Descriptors.License.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -68,7 +67,8 @@ public partial class GetLicenseDescriptor : RequestDescriptorBase false; // values part of the url path // Request parameters - ///Supported for backwards compatibility with 7.x. If this param is used it must be set to true [Obsolete("Scheduled to be removed in 7.0, Deprecated as of: 8.0.0, reason: Supported for backwards compatibility with 7.x. If this param is used it must be set to true")] + ///Supported for backwards compatibility with 7.x. If this param is used it must be set to true + [Obsolete("Scheduled to be removed in 8.0, Deprecated as of: 8.0.0, reason: Supported for backwards compatibility with 7.x. If this param is used it must be set to true")] public GetLicenseDescriptor AcceptEnterprise(bool? acceptenterprise = true) => Qs("accept_enterprise", acceptenterprise); ///Return local information, do not retrieve the state from master node (default: false) public GetLicenseDescriptor Local(bool? local = true) => Qs("local", local); diff --git a/src/Nest/Descriptors.MachineLearning.cs b/src/Nest/Descriptors.MachineLearning.cs index 64b04acf093..e17d3b7eed7 100644 --- a/src/Nest/Descriptors.MachineLearning.cs +++ b/src/Nest/Descriptors.MachineLearning.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -71,7 +70,8 @@ protected CloseJobDescriptor(): base() // values part of the url path Id ICloseJobRequest.JobId => Self.RouteValues.Get("job_id"); // Request parameters - ///Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) [Obsolete("Scheduled to be removed in 7.0, deprecated")] + ///Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + [Obsolete("Scheduled to be removed in 8.0, deprecated")] public CloseJobDescriptor AllowNoJobs(bool? allownojobs = true) => Qs("allow_no_jobs", allownojobs); ///Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) public CloseJobDescriptor AllowNoMatch(bool? allownomatch = true) => Qs("allow_no_match", allownomatch); @@ -517,7 +517,8 @@ public GetDatafeedStatsDescriptor(): base() ///The ID of the datafeeds stats to fetch public GetDatafeedStatsDescriptor DatafeedId(Id datafeedId) => Assign(datafeedId, (a, v) => a.RouteValues.Optional("datafeed_id", v)); // Request parameters - ///Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) [Obsolete("Scheduled to be removed in 7.0, deprecated")] + ///Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + [Obsolete("Scheduled to be removed in 8.0, deprecated")] public GetDatafeedStatsDescriptor AllowNoDatafeeds(bool? allownodatafeeds = true) => Qs("allow_no_datafeeds", allownodatafeeds); ///Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) public GetDatafeedStatsDescriptor AllowNoMatch(bool? allownomatch = true) => Qs("allow_no_match", allownomatch); @@ -545,7 +546,8 @@ public GetDatafeedsDescriptor(): base() ///The ID of the datafeeds to fetch public GetDatafeedsDescriptor DatafeedId(Id datafeedId) => Assign(datafeedId, (a, v) => a.RouteValues.Optional("datafeed_id", v)); // Request parameters - ///Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) [Obsolete("Scheduled to be removed in 7.0, deprecated")] + ///Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + [Obsolete("Scheduled to be removed in 8.0, deprecated")] public GetDatafeedsDescriptor AllowNoDatafeeds(bool? allownodatafeeds = true) => Qs("allow_no_datafeeds", allownodatafeeds); ///Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) public GetDatafeedsDescriptor AllowNoMatch(bool? allownomatch = true) => Qs("allow_no_match", allownomatch); @@ -626,7 +628,8 @@ public GetJobStatsDescriptor(Id jobId): base(r => r.Optional("job_id", jobId)) ///The ID of the jobs stats to fetch public GetJobStatsDescriptor JobId(Id jobId) => Assign(jobId, (a, v) => a.RouteValues.Optional("job_id", v)); // Request parameters - ///Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) [Obsolete("Scheduled to be removed in 7.0, deprecated")] + ///Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + [Obsolete("Scheduled to be removed in 8.0, deprecated")] public GetJobStatsDescriptor AllowNoJobs(bool? allownojobs = true) => Qs("allow_no_jobs", allownojobs); ///Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) public GetJobStatsDescriptor AllowNoMatch(bool? allownomatch = true) => Qs("allow_no_match", allownomatch); @@ -654,7 +657,8 @@ public GetJobsDescriptor(): base() ///The ID of the jobs to fetch public GetJobsDescriptor JobId(Id jobId) => Assign(jobId, (a, v) => a.RouteValues.Optional("job_id", v)); // Request parameters - ///Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) [Obsolete("Scheduled to be removed in 7.0, deprecated")] + ///Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + [Obsolete("Scheduled to be removed in 8.0, deprecated")] public GetJobsDescriptor AllowNoJobs(bool? allownojobs = true) => Qs("allow_no_jobs", allownojobs); ///Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) public GetJobsDescriptor AllowNoMatch(bool? allownomatch = true) => Qs("allow_no_match", allownomatch); @@ -830,22 +834,23 @@ protected PostJobDataDescriptor(): base() public partial class PreviewDatafeedDescriptor : RequestDescriptorBase, IPreviewDatafeedRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningPreviewDatafeed; - protected override HttpMethod HttpMethod => HttpMethod.GET; - protected override bool SupportsBody => false; + protected override HttpMethod HttpMethod => HttpMethod.POST; + protected override bool SupportsBody => true; ////_ml/datafeeds/{datafeed_id}/_preview - ///this parameter is required - public PreviewDatafeedDescriptor(Id datafeedId): base(r => r.Required("datafeed_id", datafeedId)) + ///Optional, accepts null + public PreviewDatafeedDescriptor(Id datafeedId): base(r => r.Optional("datafeed_id", datafeedId)) { } - ///Used for serialization purposes, making sure we have a parameterless constructor - [SerializationConstructor] - protected PreviewDatafeedDescriptor(): base() + ////_ml/datafeeds/_preview + public PreviewDatafeedDescriptor(): base() { } // values part of the url path Id IPreviewDatafeedRequest.DatafeedId => Self.RouteValues.Get("datafeed_id"); + ///The ID of the datafeed to preview + public PreviewDatafeedDescriptor DatafeedId(Id datafeedId) => Assign(datafeedId, (a, v) => a.RouteValues.Optional("datafeed_id", v)); // Request parameters } @@ -1057,7 +1062,8 @@ protected StopDatafeedDescriptor(): base() // values part of the url path Id IStopDatafeedRequest.DatafeedId => Self.RouteValues.Get("datafeed_id"); // Request parameters - ///Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) [Obsolete("Scheduled to be removed in 7.0, deprecated")] + ///Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + [Obsolete("Scheduled to be removed in 8.0, deprecated")] public StopDatafeedDescriptor AllowNoDatafeeds(bool? allownodatafeeds = true) => Qs("allow_no_datafeeds", allownodatafeeds); ///Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) public StopDatafeedDescriptor AllowNoMatch(bool? allownomatch = true) => Qs("allow_no_match", allownomatch); diff --git a/src/Nest/Descriptors.Migration.cs b/src/Nest/Descriptors.Migration.cs index 18956f3ac3d..059bcff9df5 100644 --- a/src/Nest/Descriptors.Migration.cs +++ b/src/Nest/Descriptors.Migration.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.NoNamespace.cs b/src/Nest/Descriptors.NoNamespace.cs index 65bac37465a..ee59ee39976 100644 --- a/src/Nest/Descriptors.NoNamespace.cs +++ b/src/Nest/Descriptors.NoNamespace.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -1411,6 +1410,8 @@ public SearchDescriptor Index() public SearchDescriptor Lenient(bool? lenient = true) => Qs("lenient", lenient); ///The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests public SearchDescriptor MaxConcurrentShardRequests(long? maxconcurrentshardrequests) => Qs("max_concurrent_shard_requests", maxconcurrentshardrequests); + ///The minimum compatible version that all shards involved in search should have for this request to be successful + public SearchDescriptor MinCompatibleShardNode(string mincompatibleshardnode) => Qs("min_compatible_shard_node", mincompatibleshardnode); ///A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. public SearchDescriptor PreFilterShardSize(long? prefiltershardsize) => Qs("pre_filter_shard_size", prefiltershardsize); ///Specify the node or shard the operation should be performed on (default: random) diff --git a/src/Nest/Descriptors.Nodes.cs b/src/Nest/Descriptors.Nodes.cs index 0dccfc31e7d..409440c860d 100644 --- a/src/Nest/Descriptors.Nodes.cs +++ b/src/Nest/Descriptors.Nodes.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -212,14 +211,14 @@ public NodesStatsDescriptor(NodeIds nodeId, Metrics metric, IndexMetrics indexMe ///Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. public NodesStatsDescriptor IndexMetric(IndexMetrics indexMetric) => Assign(indexMetric, (a, v) => a.RouteValues.Optional("index_metric", v)); // Request parameters - ///A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) + ///A comma-separated list of fields for the `completion` index metric (supports wildcards) public NodesStatsDescriptor CompletionFields(Fields completionfields) => Qs("completion_fields", completionfields); - ///A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) + ///A comma-separated list of fields for the `completion` index metric (supports wildcards) public NodesStatsDescriptor CompletionFields(params Expression>[] fields) where T : class => Qs("completion_fields", fields?.Select(e => (Field)e)); - ///A comma-separated list of fields for `fielddata` index metric (supports wildcards) + ///A comma-separated list of fields for the `fielddata` index metric (supports wildcards) public NodesStatsDescriptor FielddataFields(Fields fielddatafields) => Qs("fielddata_fields", fielddatafields); - ///A comma-separated list of fields for `fielddata` index metric (supports wildcards) + ///A comma-separated list of fields for the `fielddata` index metric (supports wildcards) public NodesStatsDescriptor FielddataFields(params Expression>[] fields) where T : class => Qs("fielddata_fields", fields?.Select(e => (Field)e)); ///A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) @@ -231,6 +230,8 @@ public NodesStatsDescriptor Fields(params Expression>[] field public NodesStatsDescriptor Groups(bool? groups = true) => Qs("groups", groups); ///Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) public NodesStatsDescriptor IncludeSegmentFileSizes(bool? includesegmentfilesizes = true) => Qs("include_segment_file_sizes", includesegmentfilesizes); + ///If set to true segment stats will include stats for segments that are not currently loaded into memory + public NodesStatsDescriptor IncludeUnloadedSegments(bool? includeunloadedsegments = true) => Qs("include_unloaded_segments", includeunloadedsegments); ///Return indices stats aggregated at index, node or shard level public NodesStatsDescriptor Level(Level? level) => Qs("level", level); ///Explicit operation timeout diff --git a/src/Nest/Descriptors.Rollup.cs b/src/Nest/Descriptors.Rollup.cs index 13468230efb..fb25f78cc80 100644 --- a/src/Nest/Descriptors.Rollup.cs +++ b/src/Nest/Descriptors.Rollup.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.Security.cs b/src/Nest/Descriptors.Security.cs index 04f390c1176..22a4a210548 100644 --- a/src/Nest/Descriptors.Security.cs +++ b/src/Nest/Descriptors.Security.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.Snapshot.cs b/src/Nest/Descriptors.Snapshot.cs index 7324aedc48e..6a8ec4ff2a8 100644 --- a/src/Nest/Descriptors.Snapshot.cs +++ b/src/Nest/Descriptors.Snapshot.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -243,6 +242,8 @@ protected GetSnapshotDescriptor(): base() // Request parameters ///Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown public GetSnapshotDescriptor IgnoreUnavailable(bool? ignoreunavailable = true) => Qs("ignore_unavailable", ignoreunavailable); + ///Whether to include details of each index in the snapshot, if those details are available. Defaults to false. + public GetSnapshotDescriptor IndexDetails(bool? indexdetails = true) => Qs("index_details", indexdetails); ///Explicit operation timeout for connection to master node public GetSnapshotDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); ///Whether to show verbose snapshot info or only show the basic info found in the repository index blob @@ -370,4 +371,4 @@ protected VerifyRepositoryDescriptor(): base() ///Explicit operation timeout public VerifyRepositoryDescriptor Timeout(Time timeout) => Qs("timeout", timeout); } -} +} \ No newline at end of file diff --git a/src/Nest/Descriptors.SnapshotLifecycleManagement.cs b/src/Nest/Descriptors.SnapshotLifecycleManagement.cs index cf986f3f052..4b7f92a4040 100644 --- a/src/Nest/Descriptors.SnapshotLifecycleManagement.cs +++ b/src/Nest/Descriptors.SnapshotLifecycleManagement.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.Sql.cs b/src/Nest/Descriptors.Sql.cs index 0c3196cf1a7..317efbb2ee4 100644 --- a/src/Nest/Descriptors.Sql.cs +++ b/src/Nest/Descriptors.Sql.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.Tasks.cs b/src/Nest/Descriptors.Tasks.cs index bd1edf3f401..4ca4ffeb51e 100644 --- a/src/Nest/Descriptors.Tasks.cs +++ b/src/Nest/Descriptors.Tasks.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.Transform.cs b/src/Nest/Descriptors.Transform.cs index 1a71304cead..9ca25476927 100644 --- a/src/Nest/Descriptors.Transform.cs +++ b/src/Nest/Descriptors.Transform.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.Watcher.cs b/src/Nest/Descriptors.Watcher.cs index f9cc6f6a678..70bf78ac9f3 100644 --- a/src/Nest/Descriptors.Watcher.cs +++ b/src/Nest/Descriptors.Watcher.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Descriptors.XPack.cs b/src/Nest/Descriptors.XPack.cs index 792658e8d54..ef4ad422a41 100644 --- a/src/Nest/Descriptors.XPack.cs +++ b/src/Nest/Descriptors.XPack.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -58,7 +57,8 @@ public partial class XPackInfoDescriptor : RequestDescriptorBase false; // values part of the url path // Request parameters - ///If this param is used it must be set to true [Obsolete("Scheduled to be removed in 7.0, Deprecated as of: 8.0.0, reason: Supported for backwards compatibility with 7.x")] + ///If this param is used it must be set to true + [Obsolete("Scheduled to be removed in 8.0, Deprecated as of: 8.0.0, reason: Supported for backwards compatibility with 7.x")] public XPackInfoDescriptor AcceptEnterprise(bool? acceptenterprise = true) => Qs("accept_enterprise", acceptenterprise); ///Comma-separated list of info categories. Can be any of: build, license, features public XPackInfoDescriptor Categories(params string[] categories) => Qs("categories", categories); diff --git a/src/Nest/Descriptors.cs b/src/Nest/Descriptors.cs index 4245fc0c618..53918e51420 100644 --- a/src/Nest/Descriptors.cs +++ b/src/Nest/Descriptors.cs @@ -1,22 +1,3 @@ -/* - * 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.Collections.Generic; namespace Nest diff --git a/src/Nest/ElasticClient.AsyncSearch.cs b/src/Nest/ElasticClient.AsyncSearch.cs index d25f111edad..27e2b49ef66 100644 --- a/src/Nest/ElasticClient.AsyncSearch.cs +++ b/src/Nest/ElasticClient.AsyncSearch.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Cat.cs b/src/Nest/ElasticClient.Cat.cs index 7cfe36d4d4c..cebdb2f2121 100644 --- a/src/Nest/ElasticClient.Cat.cs +++ b/src/Nest/ElasticClient.Cat.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Cluster.cs b/src/Nest/ElasticClient.Cluster.cs index 6f51d954f74..7aca14bca4e 100644 --- a/src/Nest/ElasticClient.Cluster.cs +++ b/src/Nest/ElasticClient.Cluster.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -106,25 +105,25 @@ internal ClusterNamespace(ElasticClient client): base(client) /// /// GET request to the cluster.get_settings API, read more about this API online: /// - /// https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html + /// https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html /// public ClusterGetSettingsResponse GetSettings(Func selector = null) => GetSettings(selector.InvokeOrDefault(new ClusterGetSettingsDescriptor())); /// /// GET request to the cluster.get_settings API, read more about this API online: /// - /// https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html + /// https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html /// public Task GetSettingsAsync(Func selector = null, CancellationToken ct = default) => GetSettingsAsync(selector.InvokeOrDefault(new ClusterGetSettingsDescriptor()), ct); /// /// GET request to the cluster.get_settings API, read more about this API online: /// - /// https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html + /// https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html /// public ClusterGetSettingsResponse GetSettings(IClusterGetSettingsRequest request) => DoRequest(request, request.RequestParameters); /// /// GET request to the cluster.get_settings API, read more about this API online: /// - /// https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html + /// https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html /// public Task GetSettingsAsync(IClusterGetSettingsRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); /// diff --git a/src/Nest/ElasticClient.CrossClusterReplication.cs b/src/Nest/ElasticClient.CrossClusterReplication.cs index 2beae85c556..04ef65d1615 100644 --- a/src/Nest/ElasticClient.CrossClusterReplication.cs +++ b/src/Nest/ElasticClient.CrossClusterReplication.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.DanglingIndices.cs b/src/Nest/ElasticClient.DanglingIndices.cs index 7b05aace8cc..9b784f5211c 100644 --- a/src/Nest/ElasticClient.DanglingIndices.cs +++ b/src/Nest/ElasticClient.DanglingIndices.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Enrich.cs b/src/Nest/ElasticClient.Enrich.cs index e01052cc937..ff21b88dba3 100644 --- a/src/Nest/ElasticClient.Enrich.cs +++ b/src/Nest/ElasticClient.Enrich.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Eql.cs b/src/Nest/ElasticClient.Eql.cs new file mode 100644 index 00000000000..23c5b658e65 --- /dev/null +++ b/src/Nest/ElasticClient.Eql.cs @@ -0,0 +1,100 @@ +/* + * 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. + */ +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ----------------------------------------------- +// +// This file is automatically generated +// Please do not edit these files manually +// Run the following in the root of the repos: +// +// *NIX : ./build.sh codegen +// Windows : build.bat codegen +// +// ----------------------------------------------- +// ReSharper disable RedundantUsingDirective +using System; +using System.Threading; +using System.Threading.Tasks; +using Elasticsearch.Net.Specification.EqlApi; + +// ReSharper disable once CheckNamespace +// ReSharper disable RedundantTypeArgumentsOfMethod +namespace Nest.Specification.EqlApi +{ + /// + /// Eql APIs. + /// Not intended to be instantiated directly. Use the property + /// on . + /// + /// + public class EqlNamespace : NamespacedClientProxy + { + internal EqlNamespace(ElasticClient client): base(client) + { + } + + /// + /// POST request to the eql.search API, read more about this API online: + /// + /// https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html + /// + public EqlSearchResponse Search(Func, IEqlSearchRequest> selector = null) + where TInferDocument : class where TDocument : class => Search(selector.InvokeOrDefault(new EqlSearchDescriptor())); + /// + /// POST request to the eql.search API, read more about this API online: + /// + /// https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html + /// + public Task> SearchAsync(Func, IEqlSearchRequest> selector = null, CancellationToken ct = default) + where TInferDocument : class where TDocument : class => SearchAsync(selector.InvokeOrDefault(new EqlSearchDescriptor()), ct); + /// + /// POST request to the eql.search API, read more about this API online: + /// + /// https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html + /// + public EqlSearchResponse Search(Func, IEqlSearchRequest> selector = null) + where TDocument : class => Search(selector.InvokeOrDefault(new EqlSearchDescriptor())); + /// + /// POST request to the eql.search API, read more about this API online: + /// + /// https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html + /// + public Task> SearchAsync(Func, IEqlSearchRequest> selector = null, CancellationToken ct = default) + where TDocument : class => SearchAsync(selector.InvokeOrDefault(new EqlSearchDescriptor()), ct); + /// + /// POST request to the eql.search API, read more about this API online: + /// + /// https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html + /// + public EqlSearchResponse Search(IEqlSearchRequest request) + where TDocument : class => DoRequest>(request, request.RequestParameters); + /// + /// POST request to the eql.search API, read more about this API online: + /// + /// https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html + /// + public Task> SearchAsync(IEqlSearchRequest request, CancellationToken ct = default) + where TDocument : class => DoRequestAsync>(request, request.RequestParameters, ct); + } +} \ No newline at end of file diff --git a/src/Nest/ElasticClient.Graph.cs b/src/Nest/ElasticClient.Graph.cs index 5a65c3cd8ed..1576624176c 100644 --- a/src/Nest/ElasticClient.Graph.cs +++ b/src/Nest/ElasticClient.Graph.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.IndexLifecycleManagement.cs b/src/Nest/ElasticClient.IndexLifecycleManagement.cs index 2915171e738..60a9fe608ec 100644 --- a/src/Nest/ElasticClient.IndexLifecycleManagement.cs +++ b/src/Nest/ElasticClient.IndexLifecycleManagement.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Indices.cs b/src/Nest/ElasticClient.Indices.cs index b467b7e8636..b108ae7889a 100644 --- a/src/Nest/ElasticClient.Indices.cs +++ b/src/Nest/ElasticClient.Indices.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Ingest.cs b/src/Nest/ElasticClient.Ingest.cs index fcfd3245445..b4cc6b16570 100644 --- a/src/Nest/ElasticClient.Ingest.cs +++ b/src/Nest/ElasticClient.Ingest.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.License.cs b/src/Nest/ElasticClient.License.cs index 00b8a7be15d..95cdb263992 100644 --- a/src/Nest/ElasticClient.License.cs +++ b/src/Nest/ElasticClient.License.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.MachineLearning.cs b/src/Nest/ElasticClient.MachineLearning.cs index c3f64c7f8c7..cda9ae94bd5 100644 --- a/src/Nest/ElasticClient.MachineLearning.cs +++ b/src/Nest/ElasticClient.MachineLearning.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -778,28 +777,28 @@ public Task EstimateModelMemoryAsync(Fun /// public Task PostJobDataAsync(IPostJobDataRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); /// - /// GET request to the ml.preview_datafeed API, read more about this API online: + /// POST request to the ml.preview_datafeed API, read more about this API online: /// /// https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html /// - public PreviewDatafeedResponse PreviewDatafeed(Id datafeedId, Func selector = null) - where TDocument : class => PreviewDatafeed(selector.InvokeOrDefault(new PreviewDatafeedDescriptor(datafeedId: datafeedId))); + public PreviewDatafeedResponse PreviewDatafeed(Func selector = null) + where TDocument : class => PreviewDatafeed(selector.InvokeOrDefault(new PreviewDatafeedDescriptor())); /// - /// GET request to the ml.preview_datafeed API, read more about this API online: + /// POST request to the ml.preview_datafeed API, read more about this API online: /// /// https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html /// - public Task> PreviewDatafeedAsync(Id datafeedId, Func selector = null, CancellationToken ct = default) - where TDocument : class => PreviewDatafeedAsync(selector.InvokeOrDefault(new PreviewDatafeedDescriptor(datafeedId: datafeedId)), ct); + public Task> PreviewDatafeedAsync(Func selector = null, CancellationToken ct = default) + where TDocument : class => PreviewDatafeedAsync(selector.InvokeOrDefault(new PreviewDatafeedDescriptor()), ct); /// - /// GET request to the ml.preview_datafeed API, read more about this API online: + /// POST request to the ml.preview_datafeed API, read more about this API online: /// /// https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html /// public PreviewDatafeedResponse PreviewDatafeed(IPreviewDatafeedRequest request) where TDocument : class => DoRequest>(request, ResponseBuilder(request.RequestParameters, PreviewDatafeedResponseBuilder.Instance)); /// - /// GET request to the ml.preview_datafeed API, read more about this API online: + /// POST request to the ml.preview_datafeed API, read more about this API online: /// /// https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html /// diff --git a/src/Nest/ElasticClient.Migration.cs b/src/Nest/ElasticClient.Migration.cs index 42d58d9ae80..9940e41ee4d 100644 --- a/src/Nest/ElasticClient.Migration.cs +++ b/src/Nest/ElasticClient.Migration.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.NoNamespace.cs b/src/Nest/ElasticClient.NoNamespace.cs index 0109416c80a..27e72e25032 100644 --- a/src/Nest/ElasticClient.NoNamespace.cs +++ b/src/Nest/ElasticClient.NoNamespace.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -44,6 +43,7 @@ using Nest.Specification.CrossClusterReplicationApi; using Nest.Specification.DanglingIndicesApi; using Nest.Specification.EnrichApi; +using Nest.Specification.EqlApi; using Nest.Specification.GraphApi; using Nest.Specification.IndexLifecycleManagementApi; using Nest.Specification.IndicesApi; @@ -112,6 +112,13 @@ public EnrichNamespace Enrich private set; } + ///Eql APIs + public EqlNamespace Eql + { + get; + private set; + } + ///Graph APIs public GraphNamespace Graph { @@ -239,6 +246,7 @@ partial void SetupNamespaces() CrossClusterReplication = new CrossClusterReplicationNamespace(this); DanglingIndices = new DanglingIndicesNamespace(this); Enrich = new EnrichNamespace(this); + Eql = new EqlNamespace(this); Graph = new GraphNamespace(this); IndexLifecycleManagement = new IndexLifecycleManagementNamespace(this); Indices = new IndicesNamespace(this); diff --git a/src/Nest/ElasticClient.Nodes.cs b/src/Nest/ElasticClient.Nodes.cs index e3fb0b3a55c..f03c35e45da 100644 --- a/src/Nest/ElasticClient.Nodes.cs +++ b/src/Nest/ElasticClient.Nodes.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Rollup.cs b/src/Nest/ElasticClient.Rollup.cs index 065f18e5bf9..2135eac9088 100644 --- a/src/Nest/ElasticClient.Rollup.cs +++ b/src/Nest/ElasticClient.Rollup.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Security.cs b/src/Nest/ElasticClient.Security.cs index 8c0fe3df60f..ca6772dfabd 100644 --- a/src/Nest/ElasticClient.Security.cs +++ b/src/Nest/ElasticClient.Security.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Snapshot.cs b/src/Nest/ElasticClient.Snapshot.cs index d04d8f616e6..cbad4d702ea 100644 --- a/src/Nest/ElasticClient.Snapshot.cs +++ b/src/Nest/ElasticClient.Snapshot.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.SnapshotLifecycleManagement.cs b/src/Nest/ElasticClient.SnapshotLifecycleManagement.cs index 9a307e8ce3e..aa62efbf27f 100644 --- a/src/Nest/ElasticClient.SnapshotLifecycleManagement.cs +++ b/src/Nest/ElasticClient.SnapshotLifecycleManagement.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Sql.cs b/src/Nest/ElasticClient.Sql.cs index 42a57f28e8d..f08a592bce6 100644 --- a/src/Nest/ElasticClient.Sql.cs +++ b/src/Nest/ElasticClient.Sql.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Tasks.cs b/src/Nest/ElasticClient.Tasks.cs index 7e468b573a5..05d07b22a4f 100644 --- a/src/Nest/ElasticClient.Tasks.cs +++ b/src/Nest/ElasticClient.Tasks.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Transform.cs b/src/Nest/ElasticClient.Transform.cs index 109dda00cd9..03df53aac00 100644 --- a/src/Nest/ElasticClient.Transform.cs +++ b/src/Nest/ElasticClient.Transform.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.Watcher.cs b/src/Nest/ElasticClient.Watcher.cs index 24cf6e2b74e..b985eb03e23 100644 --- a/src/Nest/ElasticClient.Watcher.cs +++ b/src/Nest/ElasticClient.Watcher.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/ElasticClient.XPack.cs b/src/Nest/ElasticClient.XPack.cs index a1dbf16a454..922ea9cf2bc 100644 --- a/src/Nest/ElasticClient.XPack.cs +++ b/src/Nest/ElasticClient.XPack.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/IElasticClient.Generated.cs b/src/Nest/IElasticClient.Generated.cs index 37c5df2cce5..40b52f13fc2 100644 --- a/src/Nest/IElasticClient.Generated.cs +++ b/src/Nest/IElasticClient.Generated.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -46,6 +45,7 @@ using Nest.Specification.CrossClusterReplicationApi; using Nest.Specification.DanglingIndicesApi; using Nest.Specification.EnrichApi; +using Nest.Specification.EqlApi; using Nest.Specification.GraphApi; using Nest.Specification.IndexLifecycleManagementApi; using Nest.Specification.IndicesApi; @@ -107,6 +107,12 @@ EnrichNamespace Enrich get; } + ///Eql APIs + EqlNamespace Eql + { + get; + } + ///Graph APIs GraphNamespace Graph { diff --git a/src/Nest/Requests.AsyncSearch.cs b/src/Nest/Requests.AsyncSearch.cs index ae1320d32ac..1a55fde43d5 100644 --- a/src/Nest/Requests.AsyncSearch.cs +++ b/src/Nest/Requests.AsyncSearch.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -456,4 +455,4 @@ public AsyncSearchSubmitRequest(Indices index): base(index) { } } -} +} \ No newline at end of file diff --git a/src/Nest/Requests.Cat.cs b/src/Nest/Requests.Cat.cs index 1845124f916..dd0e1a94d88 100644 --- a/src/Nest/Requests.Cat.cs +++ b/src/Nest/Requests.Cat.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -1144,6 +1143,13 @@ public bool? Help set => Q("help", value); } + ///If set to true segment stats will include stats for segments that are not currently loaded into memory + public bool? IncludeUnloadedSegments + { + get => Q("include_unloaded_segments"); + set => Q("include_unloaded_segments", value); + } + ///Explicit operation timeout for connection to master node public Time MasterTimeout { diff --git a/src/Nest/Requests.Cluster.cs b/src/Nest/Requests.Cluster.cs index 36cbf9eb647..450503cbdb6 100644 --- a/src/Nest/Requests.Cluster.cs +++ b/src/Nest/Requests.Cluster.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ @@ -107,7 +106,7 @@ public partial interface IClusterGetSettingsRequest : IRequestRequest for GetSettings https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html + ///Request for GetSettings https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-get-settings.html public partial class ClusterGetSettingsRequest : PlainRequestBase, IClusterGetSettingsRequest { protected IClusterGetSettingsRequest Self => this; diff --git a/src/Nest/Requests.CrossClusterReplication.cs b/src/Nest/Requests.CrossClusterReplication.cs index 2162f0f50e3..93b3b85a291 100644 --- a/src/Nest/Requests.CrossClusterReplication.cs +++ b/src/Nest/Requests.CrossClusterReplication.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Requests.DanglingIndices.cs b/src/Nest/Requests.DanglingIndices.cs index d54bc75f316..823673fbfa9 100644 --- a/src/Nest/Requests.DanglingIndices.cs +++ b/src/Nest/Requests.DanglingIndices.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Requests.Enrich.cs b/src/Nest/Requests.Enrich.cs index 29982adcdbc..c7d7ce15403 100644 --- a/src/Nest/Requests.Enrich.cs +++ b/src/Nest/Requests.Enrich.cs @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ diff --git a/src/Nest/Requests.Eql.cs b/src/Nest/Requests.Eql.cs new file mode 100644 index 00000000000..1143f1dc1b6 --- /dev/null +++ b/src/Nest/Requests.Eql.cs @@ -0,0 +1,129 @@ +/* + * 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. + */ +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ----------------------------------------------- +// +// This file is automatically generated +// Please do not edit these files manually +// Run the following in the root of the repos: +// +// *NIX : ./build.sh codegen +// Windows : build.bat codegen +// +// ----------------------------------------------- +// ReSharper disable RedundantUsingDirective +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Linq.Expressions; +using System.Runtime.Serialization; +using Elastic.Transport; +using Elasticsearch.Net; +using Nest.Utf8Json; +using Elasticsearch.Net.Specification.EqlApi; + +// ReSharper disable RedundantBaseConstructorCall +// ReSharper disable UnusedTypeParameter +// ReSharper disable PartialMethodWithSinglePart +// ReSharper disable RedundantNameQualifier +namespace Nest +{ + [InterfaceDataContract] + public partial interface IEqlSearchRequest : IRequest + { + [IgnoreDataMember] + Indices Index + { + get; + } + } + + public partial interface IEqlSearchRequest : IEqlSearchRequest + { + } + + ///Request for Search https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html + public partial class EqlSearchRequest : PlainRequestBase, IEqlSearchRequest + { + protected IEqlSearchRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.EqlSearch; + protected override HttpMethod HttpMethod => HttpMethod.POST; + protected override bool SupportsBody => true; + ////{index}/_eql/search + ///this parameter is required + public EqlSearchRequest(Indices index): base(r => r.Required("index", index)) + { + } + + ///Used for serialization purposes, making sure we have a parameterless constructor + [SerializationConstructor] + protected EqlSearchRequest(): base() + { + } + + // values part of the url path + [IgnoreDataMember] + Indices IEqlSearchRequest.Index => Self.RouteValues.Get("index"); + // Request parameters + ///Update the time interval in which the results (partial or final) for this search will be available + public Time KeepAlive + { + get => Q