elasticsearch - How to run a query with the properties from a stored document? -
let's have index docs contain following fields: uid , hobbies. how can run query find similarities between 1 , other users, without having retrieve user first , run new query hobbies?
you use more this query , ask es retrieve documents given document (e.g. user uid=1
) (without having retrieve document first).
so in like
array below give reference document needs used reference "more this" query (you can give more 1 document , verbatim hobbies strings). es retrieve document, check hobbies
field , perform "more hobbies" query on other documents.
post /users/user/_search { "query": { "more_like_this" : { "fields" : ["hobbies"], "like" : [ { "_index" : "users", "_type" : "user", "_id" : "1" <---- fill in uid of user here } ] } } }
Comments
Post a Comment