1

I know that we can write DSL queries to search OpenSearch. But for some reason, I need to execute some raw SQL queries to get the result using the dotNet client. I can execute the raw query on DevTool in the OpenSearch Dashboard but I need to execute this from the .Net Client.

POST _plugins/_sql
{
  "query":"""SELECT * FROM bookmark_questions WHERE studentId = 5"""
}

[Note: This is just a sample query.]

In ElasticSearch, it's possible. Link.

var q = new QuerySqlRequest()
{
   Query = req,
   Format = "json"
};
var resp = await _elasticClient.Sql.QueryAsync(q);

But in Opensearch, I couldn't do that. How can I execute this type of query?

1 Answers1

0

You probably want to use the low level OpenSearch client to do this, so you can construct the query yourself rather than depending on methods implemented for the high level client.

rawberry
  • 192
  • 9