Post Avro Protocol Can't get text on a START_OBJECT


(Oliver) #1

Good Morning,
I am looking for some insight into why posting this json document doesn't work in certain scenarios.
We are working with ElasticSearch and wanting to store an Avro protocol.

This is what the Avro protocol looks like (I omitted the sub namespace). It will not get inserted into ElasticSearch and gives the following error.

Keep in mind that we are not looking to use ES5 functionality of multiple types per index. This is just how the Avro protocols are defined.

org.elasticsearch.client.ResponseException: method [POST], host [http://domain.com:9200], URI [/myIndex/myId], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse [types.fields]"}],"type":"mapper_parsing_exception","reason":"failed to parse [types.fields]","caused_by":{"type":"illegal_state_exception","reason":"Can't get text on a START_OBJECT at 1:192"}},"status":400}

"fields" seems to be a keyword in mappings when creating an index so shouldn't affect this. Is that correct?

This document does not work.
POST /myIndex/myId { "protocol": "protocolName", "namespace": "com.namespace", "types": [{ "namespace": "com.namespace.name", "type": "record", "name": "myName", "fields": [{ "type": { "items": "com.namespace.another.namespace", "type": "array" }, "name": "subName" }] }] }

Changing the "type" object to just "int" still doesn't work with same error.
POST /myIndex/myId { "protocol": "protocolName", "namespace": "com.namespace", "types": [{ "namespace": "com.namespace.name", "type": "record", "name": "myName", "fields": [{ "type": "int", "name": "subName" }] }] }

Changing "fields" to "testName" keeping the "type" an object doesn't work.
POST /myIndex/myId { "protocol": "protocolName", "namespace": "com.namespace", "types": [{ "namespace": "com.namespace.name", "type": "record", "name": "myName", "testName": [{ "type": { "items": "com.namespace.another.namespace", "type": "array" }, "name": "subName" }] }] }

Changing "fields" to "testName" with the "type" from object to "int" works.
POST /myIndex/myId { "protocol": "protocolName", "namespace": "com.namespace", "types": [{ "namespace": "com.namespace.name", "type": "record", "name": "myName", "testName": [{ "type": "int", "name": "subName" }] }] }

Thank you


(Oliver) #2

Bumping


(system) #3

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