简体   繁体   中英

Elasticsearch + searckick

How can we use SQL queries like select and group on <Searchkick::Results:0x007fe289b02a20> ? I have a large dataset of cricket, and need to execute the SQL select query to get aggregated results. Its simplest use case would be: to search a player by name using searchkick, then count its total matches, scores, ball etc using SQL select and group .

you can also use SearchKick for aggregations like this

Player.search query, where: {name: params[:name]}, aggs: [:scores, :ball]

you may need to add balls and scores in players search_data if these are assosiations and not attributes of player's model.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM