Response from SQL query does not contain "Rows" (Elastic.Clients.Elasticsearch 8.1.0 .NET)

I have an Elasticsearch cluster, which contains an index called persons. I want to query the documents of the index using the SQL API of Elasticsearch. When using the REST API of Elasticsearch via Kibana everything works fine:

POST /_sql?format=csv
{
  "query": "SELECT * FROM persons"
}

However, I want to execute this query within a .NET Web API project. Therefore, I am using the latest .NET client for Elasticsearch (Elastic.Clients.Elasticsearch 8.1.0). I have already set up and configured the client, which worked fine. Now I am trying to execute the same query as mentioned above using the Elasticsearch .NET client like this:

var response = await _elasticsearchClient.Sql
                     .QueryAsync(q => q.Query("SELECT * FROM persons"));

When executing this query, Elasticsearch returns a valid response. However, this response seems to contain no results (even though the index persons contains documents). To be more precise, the response does not contain a property called "Rows". I can e.g. only access the returned columns and the cursor but not the returned rows.

I took a look at the code on GitHub and saw that the QueryResponse class does not contain a "Rows" property (see here). Am I missing something or does the Elastic.Clients.Elasticsearch 8.1.0 client not fully support the SQL API?

Hi, @felix-stnr.

You have found a bug in the client. We code generate many types in the new client, and due to a change in how the generated types are named, the partial class which adds the Rows property is no longer applying the property to the expected type.

To address this bug, I have raised an issue.

Hi @stevejgordon,
thanks for the fast response! Are there already any plans/estimations for the release date of the 8.1.1 version?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.