Skip to content

Commit b28694e

Browse files
committed
Disable extensions that do not exist for serverless (yet)
1 parent 3f554c3 commit b28694e

File tree

9 files changed

+316
-313
lines changed

9 files changed

+316
-313
lines changed

src/Elastic.Clients.Elasticsearch.Shared/Api/Eql/EqlGetResponse.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information.
44

5+
// TODO: Move away from shared project
6+
7+
#if !ELASTICSEARCH_SERVERLESS
8+
59
using System.Collections.Generic;
610
using System.Text.Json.Serialization;
711

8-
#if ELASTICSEARCH_SERVERLESS
9-
namespace Elastic.Clients.Elasticsearch.Serverless.Eql;
10-
#else
1112
namespace Elastic.Clients.Elasticsearch.Eql;
12-
#endif
1313

1414
public partial class EqlGetResponse<TEvent>
1515
{
@@ -28,3 +28,5 @@ public partial class EqlGetResponse<TEvent>
2828
[JsonIgnore]
2929
public long Total => Hits?.Total.Value ?? -1;
3030
}
31+
32+
#endif

src/Elastic.Clients.Elasticsearch.Shared/Api/IndexManagement/GetFieldMappingResponse.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information.
44

5+
// TODO: Move away from shared project
6+
7+
#if !ELASTICSEARCH_SERVERLESS
8+
59
using System;
610
using System.Collections.Generic;
711
using System.Linq.Expressions;
812
using System.Text.Json.Serialization;
9-
#if ELASTICSEARCH_SERVERLESS
10-
using Elastic.Clients.Elasticsearch.Serverless.Mapping;
11-
#else
1213
using Elastic.Clients.Elasticsearch.Mapping;
13-
#endif
1414

15-
#if ELASTICSEARCH_SERVERLESS
16-
namespace Elastic.Clients.Elasticsearch.Serverless.IndexManagement;
17-
#else
1815
namespace Elastic.Clients.Elasticsearch.IndexManagement;
19-
#endif
2016

2117
public partial class GetFieldMappingResponse
2218
{
@@ -98,3 +94,5 @@ private IReadOnlyDictionary<Field, FieldMapping> MappingsFor(IndexName index)
9894
return indexMapping.Mappings;
9995
}
10096
}
97+
98+
#endif

src/Elastic.Clients.Elasticsearch.Shared/Client/ElasticsearchClient-BulkAll.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information.
44

5+
#if !ELASTICSEARCH_SERVERLESS
6+
57
using System;
68
using System.Collections.Generic;
79
using System.Threading;
810

9-
#if ELASTICSEARCH_SERVERLESS
10-
namespace Elastic.Clients.Elasticsearch.Serverless;
11-
#else
1211
namespace Elastic.Clients.Elasticsearch;
13-
#endif
1412

1513
public partial class ElasticsearchClient
1614
{
1715
public virtual BulkAllObservable<T> BulkAll<T>(IEnumerable<T> documents, Action<BulkAllRequestDescriptor<T>> configure, CancellationToken cancellationToken = default)
18-
{
19-
var descriptor = new BulkAllRequestDescriptor<T>(documents);
20-
configure?.Invoke(descriptor);
21-
return BulkAll<T>(descriptor, cancellationToken);
22-
}
16+
{
17+
var descriptor = new BulkAllRequestDescriptor<T>(documents);
18+
configure?.Invoke(descriptor);
19+
return BulkAll<T>(descriptor, cancellationToken);
20+
}
2321

24-
public virtual BulkAllObservable<T> BulkAll<T>(IBulkAllRequest<T> request, CancellationToken cancellationToken = default) =>
25-
new(this, request, cancellationToken);
22+
public virtual BulkAllObservable<T> BulkAll<T>(IBulkAllRequest<T> request, CancellationToken cancellationToken = default) =>
23+
new(this, request, cancellationToken);
2624
}
25+
26+
#endif

src/Elastic.Clients.Elasticsearch.Shared/Client/IndicesNamespace.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information.
44

5+
// TODO: Move away from shared project
6+
7+
#if !ELASTICSEARCH_SERVERLESS
8+
59
using System.Threading.Tasks;
610
using System.Threading;
711
using System;
812

9-
#if ELASTICSEARCH_SERVERLESS
10-
namespace Elastic.Clients.Elasticsearch.Serverless.IndexManagement;
11-
#else
1213
namespace Elastic.Clients.Elasticsearch.IndexManagement;
13-
#endif
1414

1515
public partial class IndicesNamespacedClient
1616
{
@@ -57,3 +57,5 @@ public virtual Task<GetAliasResponse> GetAliasAsync(Indices indicies, Action<Get
5757
return DoRequestAsync<GetAliasRequestDescriptor, GetAliasResponse, GetAliasRequestParameters>(descriptor, cancellationToken);
5858
}
5959
}
60+
61+
#endif

src/Elastic.Clients.Elasticsearch.Shared/Core/Infer/DocumentPath/DocumentPath.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ internal interface IDocumentPath
2222
// TODO - REVIEW THIS
2323
internal sealed class DocumentPath<T> : IEquatable<DocumentPath<T>>, IDocumentPath
2424
{
25+
#if ELASTICSEARCH_SERVERLESS
26+
public DocumentPath(T document) : this(Elasticsearch.Serverless.Id.From(document)) => Document = document;
27+
#else
2528
public DocumentPath(T document) : this(Elasticsearch.Id.From(document)) => Document = document;
29+
#endif
2630

2731
public DocumentPath(Id id)
2832
{

src/Elastic.Clients.Elasticsearch.Shared/Core/Static/Infer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public static class Infer
4444

4545
public static Names Names(IEnumerable<string> names) => string.Join(",", names);
4646

47+
#if ELASTICSEARCH_SERVERLESS
48+
public static Id Id<T>(T document) where T : class => Elasticsearch.Serverless.Id.From(document);
49+
#else
4750
public static Id Id<T>(T document) where T : class => Elasticsearch.Id.From(document);
51+
#endif
4852

4953
public static Fields Fields<T>(params Expression<Func<T, object?>>[] fields) where T : class =>
5054
new(fields.Select(f => new Field(f)));

src/Elastic.Clients.Elasticsearch.Shared/CrossPlatform/RuntimeInformation.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
using System.Linq;
88
using System.Reflection;
99

10+
#if ELASTICSEARCH_SERVERLESS
11+
namespace Elastic.Clients.Elasticsearch.Serverless
12+
#else
1013
namespace Elastic.Clients.Elasticsearch
14+
#endif
1115
{
1216
internal static class RuntimeInformation
1317
{

src/Elastic.Clients.Elasticsearch.Shared/Helpers/BlockingSubscribeExtensions.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information.
44

5+
#if !ELASTICSEARCH_SERVERLESS
56

67
using System;
78
using System.Threading;
8-
9-
#if ELASTICSEARCH_SERVERLESS
10-
namespace Elastic.Clients.Elasticsearch.Serverless;
11-
#else
129
namespace Elastic.Clients.Elasticsearch;
13-
#endif
1410

1511
public static class BlockingSubscribeExtensions
1612
{
@@ -47,3 +43,5 @@ Func<Action<Exception>, Action, TObserver> factory
4743
return observer;
4844
}
4945
}
46+
47+
#endif

0 commit comments

Comments
 (0)