Reindex API aggregations


(Noureddine Djerroud) #1

Hello,

I'd like to know how to use Reindex API with aggregations inside query?
Let me explain. :
I've an index called index_1 with over 30 millions documents (API Logs)
id, Login, visited_page, timestamp, browser, status_code
1 xxxxx@xxxx.xxx, xxxxx, 2017-01-12 23:33:00, iPhone, 200
2 yyyyy@yyyy.yyy, yyyyyy, 2017-01-12 13:35:30, Android, 200
3 xxxxx@xxxx.xxx, xxxxx, 2017-01-11 15:12:23, iPhone, 200
4 xxxxx@xxxx.xxx, xxxxx, 2017-01-12 10:46:41, iPhone, 200

.....

I'd like the create a new index (aggregated index), that contains one line/login with all statistics:
result:
Login,total_count_connection, count_connection_day, date_first_connection, date_last_connection, count_failed_connection
xxxxx@xxxx.xxx, 140, 3, 2017-01-12 23-33-00, 2017-01-01 13:34:56, 3

Need help.
Thanks in advance.


Simulate NOT IN select
(Mark Harwood) #2

Check out the guidance on entity centric indexing: https://www.youtube.com/watch?v=yBf7oeJKH2Y
Example data and entity update scripts using Painless are here: http://bit.ly/entcent_painless


(Noureddine Djerroud) #3

Thanks for relpy.

Is it the only way to make an aggregated index (need pyton), or is it possible to do it with logstash or directly on elasticseach (Reindex API)?


(Mark Harwood) #4

Any client language that can use the REST api can make these calls to scroll the latest data from your event store and bundle up bulk updates to your entity store.


(system) #5

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