Talha Junaid
Talha Junaid

Reputation: 944

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.

Upvotes: 1

Views: 125

Answers (1)

Sikandar Tariq
Sikandar Tariq

Reputation: 1326

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.

Upvotes: 1

Related Questions