Recursivity in ES structure

Hi everyone !

I have a question about es structure and complex objects.
I need to create a complex structure with recursive objects. So I have defined a first object, for example "message", and inside message i put the reference : "$ref": "#/definitions/message" (a message can contain an other message).
It works when I parse my structure in an JSON parser, but I received a 400 error when I try to create my structure....
So first of all, is it possible to create a recursive object in ES structure? And if yes, how can i do that?
Thank you !!!!

David

It'd help if you shared the error :slight_smile:

just to contextualise the situation, my structure is construct like this :

{
"definitions" : {
"message" : {
"properties": {
...
}
},
"conversation" : {
"properties" : {

						"$ref": "#/definitions/message",
						...                				
				}
	}
},

"settings" : {
	"number_of_shards" : 1
},
  "mappings": {
     "BODY": {
        "properties": {
          	"$ref": "#/definitions/conversation"                	
        }
     }
}

}

and i've got this error :
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Expected map for property [fields] on field [$ref] but got a class java.lang.String"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [BODY]: Expected map for property [fields] on field [$ref] but got a class java.lang.String",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Expected map for property [fields] on field [$ref] but got a class java.lang.String"
}
},
"status": 400
}

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