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


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

1 Like

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.

1 Like

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