JSON Depth level

I was wondering if there's a limit on the depth of a JSON object?

I'm basically taking http://localhost:9200/_cluster/stats and reposting this back into elasticsearch.

I'm able to insert up to a depth of 4 but going higher I receive a 400 error.

Thanks

What is the actual error you are getting.

In 5.0 there is now a limit for the maximum number of fields in a document.

IIRC it's 200.

May it's what you are seeing? As Mark said, what is the error message?

Hi,

I'm running the following from powershell:

$a = Invoke-RestMethod -Uri "http://127.0.0.1:9200/_cluster/stats"
$json = $a | convertTo-json -Depth 5
Invoke-RestMethod "http://monitoring_cluster:9200/test_index/message" -Method Post -Body $json -ContentType 'application/json'

Fails with:

Message           : {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse [indices.shards.index]"}],"type":"mapper_parsing_exception","reason":"failed to parse
                          [indices.shards.index]","caused_by":{"type":"illegal_argument_exception","reason":"unknown property [shards]"}},"status":400}

If I adjust the Depth to 2 it submits fine, but it chops off tags.

Oddly enough, I saved the $json as a file and loaded it with curl and that worked fine.

curl -XPOST 'http://xx.xx.xx.xx:9200/test/test' -d @test.json
{"_index":"test","_type":"test","_id":"AVho9cHiIEEqlD75Hi_Z","_version":1,"_shards":{"total":2,"successful":2,"failed":0}

It seems the only error in Kibana would be that "Objects in Arrays are not well supported"

 nodes.jvm.versions            {
                                                     "version": "1.8.0_102",
                                                     "vm_name": "Java HotSpot(TM) 64-Bit Server VM",
                                                     "vm_version": "25.102-b14", 
                                                     "vm_vendor": "Oracle Corporation",
                                                     "count": 12
                                                     }

I'll have to see why powershell would complain.

Removed the index and started fresh. No errors from powershell this time.

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