Parsing issues with nested data

Hello ES experts,
We are running into an issue with certain documents that are ingested in by transport-couchbase. The doc is and error is listed below. Any ideas

[ { "poc": { "cas": 1511944677515919400, "docType": "Game", "docVersion": "1.0", "gameId": "4d77c7a3-c3d6-4b59-9283-08add213420d", "gameState": { "jackpot": 0, "some3History": [ null ], "some5History": [ null ] }, "gameType": "SomeGame", "guests": [], "index": 0, "isActive": true, "parentId": null, "serverFullName": null, "updateTimestamp": "2017-11-29T08:37:57.565371+00:00" } } ]

the error is:

[2018-01-15T17:06:17,340][ERROR][o.e.t.c.c.CouchbaseCAPITransportImpl] [kYdTvkJ] bulk index requestId=42898 Failing due to errors: MapperParsingException[failed to parse [doc.gameState]]; nested: IllegalStateException[Can't get text on a START_OBJECT at 1:360];

[2018-01-15T17:06:17,340][WARN ][o.e.j.s.ServletHandler   ] /poc-sandbox%2f423/_bulk_docs
java.lang.RuntimeException: MapperParsingException[failed to parse [doc.gameState]]; nested: IllegalStateException[Can't get text on a START_OBJECT at 1:360];

	at org.elasticsearch.transport.couchbase.capi.ElasticSearchCAPIBehavior.bulkDocs(ElasticSearchCAPIBehavior.java:548) ~[elasticsearch-transport-couchbase-3.0.0-cypress-es5.6.4-all.jar:?]
	at com.couchbase.capi.servlet.CAPIServlet.handleBulkDocs(CAPIServlet.java:532) ~[couchbase-capi-server-1.6.3.jar:?]
	at com.couchbase.capi.servlet.CAPIServlet.service(CAPIServlet.java:89) ~[couchbase-capi-server-1.6.3.jar:?]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845) ~[jetty-servlet-9.3.13.v20161014.jar:9.3.13.v20161014]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584) [jetty-servlet-9.3.13.v20161014.jar:9.3.13.v20161014]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.3.13.v20161014.jar:9.3.13.v20161014]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:513) [jetty-security-9.3.13.v20161014.jar:9.3.13.v20161014]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [jetty-server-9.3.13.v20161014.jar:9.3.13.v20161014]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [jetty-server-9.3.13.v20161014.jar:9.3.13.v20161014]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [jetty-servlet-9.3.13.v20161014.jar:9.3.13.v20161014]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.3.13.v20161014.jar:9.3.13.v20161014]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [jetty-server-9.3.13.v20161014.jar:9.3.13.v20161014]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.3.13.v20161014.jar:9.3.

Pretty sure that your mapping says that gamestate is a text field and here you try to put an object for that field.

Check your mapping.

Thanks David! I actually do not have have any mapping for gameState. Here is my mapping:

    "template" : "*",
    "order" : 10,
    "mappings" : {
        "couchbaseCheckpoint" : {
            "_source" : {
                "includes" : ["doc.*"]
            },
            "dynamic_templates": [
                {
                        "longs_as_strings": {
                                "match":   "[doc.id]",
                                "mapping": {
                                        "type": "text"
                                }
                        }
                },
                {
                        "longs_as_floats": {
                                "match":   "[doc.bridgeServerBalanceAmount]",
                                "mapping": {
                                        "type": "float"
                                }
                        }
                },
                {
                    "store_no_index": {
                        "match": "*",
                        "mapping": {
                            "store" : "no",
                            "index" : "no",
                            "include_in_all" : false
                        }
                    }
                }
            ]
        },
        "doc": {
                "properties": {
                        "id":    { "type": "text"  } ,
                        "doc.id":    { "type": "text"  }
                }
        },
        "_default_" : {
            "_source" : {
                "includes" : ["meta.*","doc.*"]
            },
            "properties" : {
                "meta" : {
                    "type" : "object",
                    "include_in_all" : false
                }
            }
        }
    }
}

This is a template not the actual mapping.

Thanks David! I use the DefaultTypeSelector for the mapping - https://github.com/couchbaselabs/elasticsearch-transport-couchbase/releases/tag/2.1.1-RC. For gameState why would it be an issue?

I don't know. But what is the current mapping?

GET poc-sandbox%2f423/_mapping
1 Like

Thanks David, you are right. The mapping says it is a text. Since this was auto-generated,

  • how do I override the auto-generated mapping just for one of the properties, in this case, gameState?
  • And what is there is at least one document that has gameState a string while others are an object? How do I handle hybrid types especially string / object?

Thanks again

how do I override the auto-generated mapping just for one of the properties, in this case, gameState?

If you provide a template with this field, it will applied. If this field does not exist, auto-generated mapping for this field will be applied.

How do I handle hybrid types especially string / object?

You can't. You need to fix the problem before indexing in elasticsearch.

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