For the life of me I can't find any reference to using the ElasticSearch scroll api from within Ruby on Rails and the elastisearch-model (or rails or dsl) gem.
The only thing they do reference in the docs is calling scroll directly on the client, which kind of defeats the purpose. Also, it does not use the client or any client settings you've already set in your Rails app.
I want to do something like this.
Here is the ElasticSearch query that works from within the Kibana Dev Tools:
GET model_index/_search?scroll=1m
{
"size": 100,
"query": {
"match": {
"tenant_id": 3196
}
},
"_source": "id"
}
I would have thought that I could call something like
MyModel.search scroll: '1m', ...
but instead it seems like I need to do:
# First create a client by hand
client = Elasticssearch::Client.new
result = client.search index: 'model_index',
scroll: '1m',
body: { query: { match: { tenant_id: 3196 } }, sort: '_id' }
Does anyone have any more user-friendly examples?