JSON-REF and interdocument link traversal for indexing and retrieving related docs

(mat) #1

Please can you advise on the best way to implement the use of
inter-document references eg based on JSON-REF
(https://datatracker.ietf.org/doc/draft-pbryan-zyp-json-ref/) as a special
field type of field to represent nesting or parent/child type relationships
between documents that are stored and indexed and updated seperately but
which can be queried and retrieved together.

For example I might have 2 type types of docs - blogs, and users, with an
author field on the blog post which references a user doc..

*POST /index/user/usr1 {

name : "Mat"
email: "mat@email.not"
POST /index/blog/doc1 {
title : "Doc title 1"
author: { $ref:"/index/user/usr1" }
body : "This is the body of the doc"

I would then like to be able to query for blog posts written by 'mat', and
perhaps also pass an additional request params to indicate which source
$ref fields should be expanded in the _source of the results. This
behavior, as well as boosting and other controls might also of course be
managed through mapping parameters for $ref field types.

*GET /index/blog/_search {
expand: ["author"],
query: {
term: {
author.name : "Mat"

hits: [ {
_type: "blog"
_id: "doc1"
_score: 1
_source: {
title:'Doc Title 1"
author: {
name: "Mat" ,
email: "mat@email.not"
body:"This is the body of the doc"
} ]
} *

(system) #2