Skip to content

Commit 54141f0

Browse files
Add EQL APIs (#6138) (#6139)
* Generate EQL APIs and types * Add initial EQL integration tests * Simplify aliases typed on responses * Complete EQL tests and API fixes Co-authored-by: Steve Gordon <[email protected]>
1 parent 29f444b commit 54141f0

29 files changed

+1299
-13
lines changed

src/Elastic.Clients.Elasticsearch/FutureGenerated/FutureGenerated.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,8 @@ private partial void AfterStartObject(Utf8JsonWriter writer, JsonSerializerOptio
17621762

17631763
public sealed partial class CountRequestDescriptor<TDocument>
17641764
{
1765+
public CountRequestDescriptor<TDocument> Index(Indices indices) => Assign(indices, (a, v) => a.RouteValues.Optional("index", v));
1766+
17651767
public CountRequestDescriptor<TDocument> Query(Func<QueryContainerDescriptor<TDocument>, QueryContainer> configure)
17661768
{
17671769
var container = configure?.Invoke(new QueryContainerDescriptor<TDocument>());
@@ -1776,6 +1778,27 @@ public SearchRequest(Indices? indices) : base(indices)
17761778
}
17771779
}
17781780

1781+
namespace Elastic.Clients.Elasticsearch.Eql
1782+
{
1783+
public partial class GetEqlResponse<TEvent>
1784+
{
1785+
private IReadOnlyCollection<HitsEvent<TEvent>> _events;
1786+
private IReadOnlyCollection<HitsSequence<TEvent>> _sequences;
1787+
1788+
1789+
[JsonIgnore]
1790+
public IReadOnlyCollection<HitsEvent<TEvent>> Events =>
1791+
_events ??= Hits?.Events ?? EmptyReadOnly<HitsEvent<TEvent>>.Collection;
1792+
1793+
[JsonIgnore]
1794+
public IReadOnlyCollection<HitsSequence<TEvent>> Sequences =>
1795+
_sequences ??= Hits?.Sequences ?? EmptyReadOnly<HitsSequence<TEvent>>.Collection;
1796+
1797+
[JsonIgnore]
1798+
public long Total => Hits?.Total.Value ?? -1;
1799+
}
1800+
}
1801+
17791802
namespace Elastic.Clients.Elasticsearch.Analysis
17801803
{
17811804
// TODO: Generator should handle these

src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlsLookup.g.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ internal static class ApiUrlsLookups
3232
internal static ApiUrls NoNamespaceCount = new ApiUrls(new[] { "/_count", "/{index}/_count" });
3333
internal static ApiUrls NoNamespaceCreate = new ApiUrls(new[] { "/{index}/_create/{id}" });
3434
internal static ApiUrls NoNamespaceDelete = new ApiUrls(new[] { "/{index}/_doc/{id}" });
35+
internal static ApiUrls EqlDelete = new ApiUrls(new[] { "/_eql/search/{id}" });
36+
internal static ApiUrls EqlGetStatus = new ApiUrls(new[] { "/_eql/search/status/{id}" });
37+
internal static ApiUrls EqlSearch = new ApiUrls(new[] { "/{index}/_eql/search" });
38+
internal static ApiUrls EqlGet = new ApiUrls(new[] { "/_eql/search/{id}" });
3539
internal static ApiUrls NoNamespaceExists = new ApiUrls(new[] { "/{index}/_doc/{id}" });
3640
internal static ApiUrls NoNamespaceGet = new ApiUrls(new[] { "/{index}/_doc/{id}" });
3741
internal static ApiUrls IndexManagementDelete = new ApiUrls(new[] { "/{index}" });

src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterAllocationExplainResponse.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public partial class ClusterAllocationExplainResponse : ResponseBase
8686

8787
[JsonInclude]
8888
[JsonPropertyName("index")]
89-
public Elastic.Clients.Elasticsearch.IndexName Index { get; init; }
89+
public string Index { get; init; }
9090

9191
[JsonInclude]
9292
[JsonPropertyName("move_explanation")]

src/Elastic.Clients.Elasticsearch/_Generated/Api/Cluster/ClusterHealthResponse.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public partial class ClusterHealthResponse : ResponseBase
3838

3939
[JsonInclude]
4040
[JsonPropertyName("cluster_name")]
41-
public Elastic.Clients.Elasticsearch.Name ClusterName { get; init; }
41+
public string ClusterName { get; init; }
4242

4343
[JsonInclude]
4444
[JsonPropertyName("delayed_unassigned_shards")]
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Transport;
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Linq.Expressions;
22+
using System.Text.Json;
23+
using System.Text.Json.Serialization;
24+
25+
#nullable restore
26+
namespace Elastic.Clients.Elasticsearch.Eql
27+
{
28+
public class DeleteEqlRequestParameters : RequestParameters<DeleteEqlRequestParameters>
29+
{
30+
}
31+
32+
public partial class DeleteEqlRequest : PlainRequestBase<DeleteEqlRequestParameters>
33+
{
34+
public DeleteEqlRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id))
35+
{
36+
}
37+
38+
internal override ApiUrls ApiUrls => ApiUrlsLookups.EqlDelete;
39+
protected override HttpMethod HttpMethod => HttpMethod.DELETE;
40+
protected override bool SupportsBody => false;
41+
}
42+
43+
public sealed partial class DeleteEqlRequestDescriptor : RequestDescriptorBase<DeleteEqlRequestDescriptor, DeleteEqlRequestParameters>
44+
{
45+
public DeleteEqlRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id))
46+
{
47+
}
48+
49+
internal DeleteEqlRequestDescriptor()
50+
{
51+
}
52+
53+
internal DeleteEqlRequestDescriptor(Action<DeleteEqlRequestDescriptor> configure) => configure.Invoke(this);
54+
internal override ApiUrls ApiUrls => ApiUrlsLookups.EqlDelete;
55+
protected override HttpMethod HttpMethod => HttpMethod.DELETE;
56+
protected override bool SupportsBody => false;
57+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
58+
{
59+
}
60+
}
61+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Transport.Products.Elasticsearch;
19+
using System.Collections.Generic;
20+
using System.Text.Json.Serialization;
21+
22+
#nullable restore
23+
namespace Elastic.Clients.Elasticsearch.Eql
24+
{
25+
public partial class DeleteEqlResponse : AcknowledgedResponseBase
26+
{
27+
}
28+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Transport;
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Linq.Expressions;
22+
using System.Text.Json;
23+
using System.Text.Json.Serialization;
24+
25+
#nullable restore
26+
namespace Elastic.Clients.Elasticsearch.Eql
27+
{
28+
public class EqlGetStatusRequestParameters : RequestParameters<EqlGetStatusRequestParameters>
29+
{
30+
}
31+
32+
public partial class EqlGetStatusRequest : PlainRequestBase<EqlGetStatusRequestParameters>
33+
{
34+
public EqlGetStatusRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id))
35+
{
36+
}
37+
38+
internal override ApiUrls ApiUrls => ApiUrlsLookups.EqlGetStatus;
39+
protected override HttpMethod HttpMethod => HttpMethod.GET;
40+
protected override bool SupportsBody => false;
41+
}
42+
43+
public sealed partial class EqlGetStatusRequestDescriptor : RequestDescriptorBase<EqlGetStatusRequestDescriptor, EqlGetStatusRequestParameters>
44+
{
45+
public EqlGetStatusRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id))
46+
{
47+
}
48+
49+
internal EqlGetStatusRequestDescriptor()
50+
{
51+
}
52+
53+
internal EqlGetStatusRequestDescriptor(Action<EqlGetStatusRequestDescriptor> configure) => configure.Invoke(this);
54+
internal override ApiUrls ApiUrls => ApiUrlsLookups.EqlGetStatus;
55+
protected override HttpMethod HttpMethod => HttpMethod.GET;
56+
protected override bool SupportsBody => false;
57+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
58+
{
59+
}
60+
}
61+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Transport.Products.Elasticsearch;
19+
using System.Collections.Generic;
20+
using System.Text.Json.Serialization;
21+
22+
#nullable restore
23+
namespace Elastic.Clients.Elasticsearch.Eql
24+
{
25+
public partial class EqlGetStatusResponse : ResponseBase
26+
{
27+
[JsonInclude]
28+
[JsonPropertyName("completion_status")]
29+
public int? CompletionStatus { get; init; }
30+
31+
[JsonInclude]
32+
[JsonPropertyName("expiration_time_in_millis")]
33+
public Elastic.Clients.Elasticsearch.EpochMillis? ExpirationTimeInMillis { get; init; }
34+
35+
[JsonInclude]
36+
[JsonPropertyName("id")]
37+
public string Id { get; init; }
38+
39+
[JsonInclude]
40+
[JsonPropertyName("is_partial")]
41+
public bool IsPartial { get; init; }
42+
43+
[JsonInclude]
44+
[JsonPropertyName("is_running")]
45+
public bool IsRunning { get; init; }
46+
47+
[JsonInclude]
48+
[JsonPropertyName("start_time_in_millis")]
49+
public Elastic.Clients.Elasticsearch.EpochMillis? StartTimeInMillis { get; init; }
50+
}
51+
}

0 commit comments

Comments
 (0)