Akash Suryawanshi created METAMODEL-225:
-------------------------------------------

             Summary: Metamodel throws a UnsupportedOperationException for 
documents containing nested JSON in ElasticSearch
                 Key: METAMODEL-225
                 URL: https://issues.apache.org/jira/browse/METAMODEL-225
             Project: Apache MetaModel
          Issue Type: Bug
            Reporter: Akash Suryawanshi


I am using metamodel to connect to elastic search. I created a document in an 
index
{code}
PUT /megacorp/employee/1
{
    "email":      "[email protected]",
    "first_name": "John",
    "last_name":  "Smith",
    "info": {
        "bio":         "Eco-warrior and defender of the weak",
        "age":         25,
        "interests": [ "dolphins", "whales" ]
    },
    "join_date": "2014/05/01"
}

I create a DataSet and call the getRow method on it. I get the following 
exception

{code}
java.lang.UnsupportedOperationException: JsonObject
        at com.google.gson.JsonElement.getAsString(JsonElement.java:191) 
~[gson-2.2.4.jar:na]
        at 
org.apache.metamodel.elasticsearch.rest.JestElasticSearchUtils.getDataFromColumnType(JestElasticSearchUtils.java:72)
 ~[MetaModel-elasticsearch-rest-4.5.0.jar:4.5.0]
        at 
org.apache.metamodel.elasticsearch.rest.JestElasticSearchUtils.createRow(JestElasticSearchUtils.java:50)
 ~[MetaModel-elasticsearch-rest-4.5.0.jar:4.5.0]
        at 
org.apache.metamodel.elasticsearch.rest.JestElasticSearchDataSet.getRow(JestElasticSearchDataSet.java:126)
 ~[MetaModel-elasticsearch-rest-4.5.0.jar:4.5.0]
{code}

However this exception does not occur when the document is a simple JSON i.e.. 
no nested JSON with any of the fields.







--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to