Skip to content

Commit eb452dc

Browse files
Stuart Camrusscam
authored andcommitted
Integration test to verify version support for inner hits in field collapsing (#3295)
* Integration test to verify version support for inner hits in field collapsing. Closes #3261
1 parent cb9ece3 commit eb452dc

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/Tests/Search/Request/InnerHitsUsageTests.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ public QueryInnerHitsApiTests(IntrusiveOperationCluster cluster, EndpointUsage u
268268
{
269269
fields = new { fullTextField = new { } }
270270
},
271-
ignore_unmapped = false
271+
ignore_unmapped = false,
272+
version = true
272273
}
273274
}
274275
},
@@ -278,7 +279,7 @@ public QueryInnerHitsApiTests(IntrusiveOperationCluster cluster, EndpointUsage u
278279
{
279280
query = new { match_all = new { } },
280281
path = "foes",
281-
inner_hits = new { }
282+
inner_hits = new { version = true }
282283
}
283284
}
284285
}
@@ -297,14 +298,16 @@ public QueryInnerHitsApiTests(IntrusiveOperationCluster cluster, EndpointUsage u
297298
.Name("princes")
298299
.Highlight(h=>h.Fields(f=>f.Field(p=>p.FullTextField)))
299300
.IgnoreUnmapped(false)
301+
.Version()
300302
)
301303

302304
) || q.Nested(n => n
303305
.Path(p => p.Foes)
304306
.Query(nq => nq.MatchAll())
305-
.InnerHits()
307+
.InnerHits(i => i.Version())
306308
)
307-
);
309+
)
310+
.Version();
308311

309312
protected override SearchRequest<King> Initializer => new SearchRequest<King>(Index, RoyalSeeder.RoyalType)
310313
{
@@ -317,21 +320,30 @@ public QueryInnerHitsApiTests(IntrusiveOperationCluster cluster, EndpointUsage u
317320
Name = "princes",
318321
DocValueFields = Field<Prince>(p=>p.Name),
319322
Highlight = Highlight.Field(Field<Prince>(p=>p.FullTextField)),
320-
IgnoreUnmapped = false
323+
IgnoreUnmapped = false,
324+
Version = true
321325
}
322326
} || new NestedQuery
323327
{
324328
Path = Field<King>(p => p.Foes),
325329
Query = new MatchAllQuery(),
326330
InnerHits = new InnerHits()
327-
}
331+
{
332+
Version = true
333+
}
334+
},
335+
Version = true
328336
};
329337

330338
protected override void ExpectResponse(ISearchResponse<King> response)
331339
{
332340
response.Hits.Should().NotBeEmpty();
333341
foreach (var hit in response.Hits)
334342
{
343+
hit.Id.Should().NotBeNullOrEmpty();
344+
hit.Index.Should().NotBeNullOrEmpty();
345+
hit.Version?.Should().Be(1);
346+
335347
var princes = hit.InnerHits["princes"].Documents<Prince>();
336348
princes.Should().NotBeEmpty();
337349
foreach (var princeHit in hit.InnerHits["princes"].Hits.Hits)
@@ -347,6 +359,7 @@ protected override void ExpectResponse(ISearchResponse<King> response)
347359
var docValueName = princeHit.Fields.ValueOf<Prince, string>(p=>p.Name);
348360
docValueName.Should().NotBeNullOrWhiteSpace("value of name on Fields");
349361

362+
princeHit.Version?.Should().Be(1);
350363
}
351364

352365
var foes = hit.InnerHits["foes"].Documents<King>();

0 commit comments

Comments
 (0)