I'm trying to create a query where I could retrieve a collection of random items but give a little boost in this randomization for the newly created items.
Currently, I'm able to do the two different queries separately but can't do it in just one. I'm a bit confused with the syntax and I guess this must be possible to achieve this.
Here is what I do to get a random collection:
Item.search( "*", body: {query: {function_score: {random_score: {seed: Time.zone.now.to_i}}} })
And here is what I do to boost the newly created items in a search (using the boost_by_recency option):
Item.search( "*", boost_by_recency: {created_at: {scale: "7d", decay: 0.5}})
When I try to merge the two queries I get errors messages about the syntax:
Item.search( "*", boost_by_recency: {created_at: {scale: "7d", decay: 0.5}}, body: {query: {function_score: {random_score: {seed: Time.zone.now.to_i}}} })
Gives me : ArgumentError (Options incompatible with body option: boost_by_recency)