You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "Akash Suryawanshi (JIRA)" <ji...@apache.org> on 2015/12/31 01:25:49 UTC

[jira] [Updated] (METAMODEL-225) Metamodel throws a UnsupportedOperationException for documents containing nested JSON in ElasticSearch

     [ https://issues.apache.org/jira/browse/METAMODEL-225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Akash Suryawanshi updated METAMODEL-225:
----------------------------------------
    Description: 
I am using metamodel to connect to elastic search. I created a document in an index
{code}
PUT /megacorp/employee/1
{
    "email":      "john@smith.com",
    "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"
}
{code}
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.





  was:
I am using metamodel to connect to elastic search. I created a document in an index
{code}
PUT /megacorp/employee/1
{
    "email":      "john@smith.com",
    "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.






> 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":      "john@smith.com",
>     "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"
> }
> {code}
> 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)