Closed
Description
Elastic.Clients.Elasticsearch version: 8.12.0
Elasticsearch version: 8.3.1
.NET runtime version: 8.0
Operating system version: MacOs Sonoma
.Should method with empty collection of actions generates incorrect json in the request to ES which leads to 400 response. NEST worked properly in the same case and sent an empty array
Steps to reproduce:
1.
Do something like this
var response = await this.Client8.SearchAsync<Contact>(
sd => sd.Routing($"{contact.OrgId}").Index("contacts-t").Query(q => q.Bool(b => b.Should(Array.Empty<Action<QueryDescriptor<ContactProjection>>>()))));
The following body will be generated
# Request:
{
"query": {
"bool": {
"should":
}
}
}
- The response will fail with 400: Unexpected character ('}' (code 125)): expected a value
Expected behavior
The following request should be sent
# Request:
{
"query": {
"bool": {
"should": []
}
}
}