Elasticsearch php nested aggregations


(Sercan KARA) #1

hi everyone,
i tired searching an trying.
I need to group the nested fields.
The sql query is as follows
SELECT p_application_category,Sum(p_recv_bytes) as download,p_date FROM ZLog2 $w group by p_application_category;


(Thiago Souza) #2

We need a little bit more of context so we can help you. Are you trying to translate that SQL query into an ES query? If so, how is the mapping for ZLog2 index (assuming this the name of index)? And what nested fields are you referring to?


(Sercan KARA) #3

I went through the problem with ElasticSearch sql plugin
Thank you.


(Thiago Souza) #4

You mean the new Elasticsearch SQL Plugin being developed that is currently unreleased? Can you give more details of the issue? What you mean by `group the nested fields? Which nestes fields?

Or did you mean some third-party SQL plugin?


(Sercan KARA) #5

i using new Elasticsearch SQL Plugin .
example Code:
"curl -H "Content-Type: application/json" -XGET 'http://localhost:9200/_sql?pretty' -d 'SELECT SUM(nested(byte.Recived)) download FROM useroam_2018.05.28 Group BY nested(source.Ip) LIMIT 10'
"
this code collects and groups the nested fields and returns them as a grouped result download


(Thiago Souza) #6

The new official SQL plugin endpoint is POST /_xpack/sql and not GET /_sql (see https://www.elastic.co/guide/en/elasticsearch/reference/6.x/sql-rest.html).

I am not sure what plugin is this that answers with GET /_sql. Maybe is this one https://github.com/NLPchina/elasticsearch-sql ? If so, this is a third-party plugin in which I am not aware of how it works.


(system) #7

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