Skip to content

Commit

Permalink
Updated to latest client
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Nov 22, 2024
1 parent cd2e310 commit 9859e81
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.15.1
image: docker.elastic.co/elasticsearch/elasticsearch:8.16.1
environment:
discovery.type: single-node
xpack.security.enabled: 'false'
Expand All @@ -19,7 +19,7 @@ services:
depends_on:
elasticsearch:
condition: service_healthy
image: docker.elastic.co/kibana/kibana:8.15.1
image: docker.elastic.co/kibana/kibana:8.16.1
ports:
- 5601:5601
networks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<ItemGroup>
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.15.6" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.16.1" />
<PackageReference Include="Exceptionless.DateTimeExtensions" Version="3.4.3" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task CanResolveSimpleCustomFilter()
_logger.LogInformation("Actual: {Request}", actualRequest);

var expectedResponse = await Client.SearchAsync<MyType>(d => d
.Index(index).Query(f => f.Bool(b => b.Filter(filter => filter.Terms(m => m.Field("id").Term(new TermsQueryField(["1"])))))));
.Index(index).Query(f => f.Bool(b => b.Filter(filter => filter.Terms(m => m.Field("id").Terms(new TermsQueryField(["1"])))))));
string expectedRequest = expectedResponse.GetRequest();
_logger.LogInformation("Expected: {Request}", expectedRequest);

Expand All @@ -63,7 +63,7 @@ public async Task CanResolveCustomFilterContainingIncludes()
_logger.LogInformation("Actual: {Request}", actualRequest);

var expectedResponse = await Client.SearchAsync<MyType>(d => d
.Index(index).Query(f => f.Bool(b => b.Filter(filter => filter.Terms(m => m.Field("id").Term(new TermsQueryField(["1", "3"])))))));
.Index(index).Query(f => f.Bool(b => b.Filter(filter => filter.Terms(m => m.Field("id").Terms(new TermsQueryField(["1", "3"])))))));
string expectedRequest = expectedResponse.GetRequest();
_logger.LogInformation("Expected: {Request}", expectedRequest);

Expand All @@ -88,7 +88,7 @@ public async Task CanResolveIncludeToCustomFilterContainingIgnoredInclude()
_logger.LogInformation("Actual: {Request}", actualRequest);

var expectedResponse = await Client.SearchAsync<MyType>(d => d
.Index(index).Query(f => f.Bool(b => b.Filter(filter => filter.Terms(m => m.Field("id").Term(new TermsQueryField(["1", "3"])))))));
.Index(index).Query(f => f.Bool(b => b.Filter(filter => filter.Terms(m => m.Field("id").Terms(new TermsQueryField(["1", "3"])))))));
string expectedRequest = expectedResponse.GetRequest();
_logger.LogInformation("Expected: {Request}", expectedRequest);

Expand Down Expand Up @@ -140,10 +140,10 @@ public async Task CanResolveMultipleCustomFilters()
.Filter(filter => filter
.Bool(b1 => b1
.Should(
s1 => s1.Terms(m => m.Field("id").Term(new TermsQueryField(["1"]))),
s1 => s1.Terms(m => m.Field("id").Terms(new TermsQueryField(["1"]))),
s2 => s2.Bool(b2 => b2
.Must(
m2 => m2.Terms(t1 => t1.Field("id").Term(new TermsQueryField(["2"]))),
m2 => m2.Terms(t1 => t1.Field("id").Terms(new TermsQueryField(["2"]))),
m2 => m2.Term(t1 => t1.Field("field1").Value("Test"))
)
)
Expand Down Expand Up @@ -174,7 +174,7 @@ public override async Task VisitAsync(GroupNode node, IQueryVisitorContext conte
string term = ToTerm(node);
var ids = await GetIdsAsync(term);
if (ids is { Count: > 0 })
node.Parent.SetQuery(new TermsQuery { Field = "id", Term = new TermsQueryField(ids.Select(FieldValue.String).ToArray()) });
node.Parent.SetQuery(new TermsQuery { Field = "id", Terms = new TermsQueryField(ids.Select(FieldValue.String).ToArray()) });
else
node.Parent.SetQuery(new TermQuery("id") { Value = "none" });

Expand Down

0 comments on commit 9859e81

Please sign in to comment.