Join relationship using Elasticsearch client interface

I am looking for any examples that implement parent-child relationship using the python interface.
I can define a mapping such as

    es.indices.create(
      index= "docpage",
      body= {
        "mappings": {
            "properties": {
             "my_join_field": { 
               "type": "join",
               "relations": {
                 "document": "page" 
               }
             }
            }
          }
        }
    )

I am then indexing a document using
res = es.index(index="docpage",doc_type="_doc",id = 1, body=jsonDict) , where jsonDict is a dict structure of document's text and other relevant info.

How do I then index a page in the document ?
When I try
res = es.index(index="docpage",doc_type="_doc",parent=1, body=page)
I get an error : RequestError(400, 'illegal_argument_exception', 'request [/docpage/_doc] contains unrecognized parameter: [parent]')

Ref. https://elasticsearch-py.readthedocs.io/en/master/api.html indicates that parent is a valid parameter.
I see that I am not providing ES with any info about document or a page when I index them.

Following the example in https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-parent-id-query.html, I tried adding
jsonDict['my_join_field']= 'document'

and a pageDict where,

pageDict['content']=page
pageDict['my_join_field']={}
pageDict['my_join_field']['parent']="1"
pageDict['my_join_field']['name']="page"

res = es.index(index="docpage",doc_type="_doc",body=pageDict) , but I get a parser error.....

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.