Skip to content

Instantly share code, notes, and snippets.

View singhpratyush's full-sized avatar

Pratyush Singh singhpratyush

View GitHub Profile
@kakakazuma
kakakazuma / es_agg_simple.java
Created September 8, 2015 06:26
elasticsearch aggregation sample by java. simple group by.
/*
ES Aggregation to get result same as result from this SQL
SELECT
fieldA, COUNT(fieldA), SUM(fieldB), AVG(fieldB)
from table
group by fieldA;
*/
//検索クエリの発行
SearchRequestBuilder searchReq = client.prepareSearch("sample_index");
searchReq.setTypes("sample_types");