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?