You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/04/21 19:02:25 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=15252203#comment-15252203 ] 

ASF GitHub Bot commented on METAMODEL-225:
------------------------------------------

GitHub user kaspersorensen opened a pull request:

    https://github.com/apache/metamodel/pull/95

    METAMODEL-225: Fixed

    Fixes METAMODEL-225 which is about nested JSON objects in ElasticSearch responses over the REST protocol.
    
    I built this branch as a continuation of the METAMODEL-235 branch, so please first review the PR for that:
    https://github.com/apache/metamodel/pull/94

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/kaspersorensen/metamodel METAMODEL-225

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metamodel/pull/95.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #95
    
----
commit 6a669d7fb2190c6349f386f38c2bb515b7b80bfe
Author: kaspersorensen <i....@gmail.com>
Date:   2016-04-21T16:44:37Z

    METAMODEL-235: Fixed

commit c5a233a65ce67d782d281e7c7e57dc425c184a19
Author: kaspersorensen <i....@gmail.com>
Date:   2016-04-21T17:00:37Z

    METAMODEL-225: Fixed

----


> 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)