How to write a query with groupBy, having and orderBy with elastic?

Hi,

I want to write a query in elastic that contain these 3 parts like sql:

  • groupBy
  • having
  • orderBy

How can I write it?

In elasticsearch you write a search request. It can have:

Group by = the aggregation part
Having = the query part
OrderBy = the sort part

Hi @ali_houshyaripour,
If you are just starting your journey with Elasticsearch, it might help you the ES-SQL translate API. You can pass an SQL query to it (with some limitations) and it can suggest an ES query. This might help you get started with Elasticsearch.