Using Elasticsearch through Searchkick.
My documents look something like this:
{
"_id" : ObjectId("54f8672f258f83ac4e7783e5"),
"n" : "Figth Club",
"dst" : "video",
"detail" : {
est: "El club de la lucha",
ent: "Figth club",
hut: "Harcosok klubja"
}
}
My Item model:
class Item
include Mongoid::Document
searchkick
def search_data
{
n: n,
est: detail.est,
ent: detail.ent,
hut: detail.hut,
}
end
end
The search query would look something like:
Item.search(query, fields: [:n, :est, :ent, :hut], limit: 10).to_a
I would like to know what field the query was found on. For example, if query="El club de la lucha"
I want to know that detail.est
is the fields where it has been found on. Is that possible?