River JDBC Structed Object Error

My JDBC River is not running when I try to use structured objects. The see
my River below, I have basic person index and type, with id fields,
firstName, and emails columns. The emails are 1 to many. When I limit the
query to only people that have 1 email address, it works.

Any ideas?

I see this in the node logs,

[2012-08-29 15:26:16,098][INFO ][org.elasticsearch.cluster.metadata]

[mynode] [_river] update_mapping [person_river] (dynamic)
[2012-08-29 15:26:16,160][ERROR][org.elasticsearch.river.jdbc] Can not
write a field name, expecting a value
org.elasticsearch.common.jackson.JsonGenerationException: Can not write a
field name, expecting a value
at
org.elasticsearch.common.jackson.impl.JsonGeneratorBase._reportError(JsonGeneratorBase.java:480)
at
org.elasticsearch.common.jackson.impl.Utf8Generator.writeFieldName(Utf8Generator.java:270)
at
org.elasticsearch.common.xcontent.json.JsonXContentGenerator.writeFieldName(JsonXContentGenerator.java:73)
at
org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.java:262)
at org.elasticsearch.river.jdbc.Merger.build(Merger.java:303)
at org.elasticsearch.river.jdbc.Merger.build(Merger.java:309)
at org.elasticsearch.river.jdbc.Merger.flush(Merger.java:219)
at org.elasticsearch.river.jdbc.Merger.close(Merger.java:251)
at
org.elasticsearch.river.jdbc.JDBCRiver$JDBCConnector.run(JDBCRiver.java:203)
at java.lang.Thread.run(Unknown Source

Here is my River

{
"type" : "jdbc",
"jdbc" : {
"driver" : "oracle.jdbc.driver.OracleDriver",
"url" : "my_url",
"user" : "myuser",
"password" : "mypass",
"sql" : "select p.PERSON_ID as "_id", p.PERSON_ID as "id",
p.FIRSTNAME as "firstName", pe.email_address as "person.emails" from
person p join person_email pe on pe.person_id = p.person_id",
"poll": "72h",
"versioning": false
},
"index" : {
"index" : "people",
"type" : "person"
}
}

--

I think I see the problem, the org.elasticsearch.river.jdbc.ValueSet class
is wiping out my id.

For example,

    ValueSet firstRow = new ValueSet(null, "person1");
    System.out.println(firstRow);
    ValueSet secondRow = new ValueSet(firstRow, "person1");
    System.out.println(secondRow);

The secondRow value array is null.

I'll create a pull request.

--

Hi Andy
I have same issue, any idea?
I did not see your pull request..

On Wednesday, August 29, 2012 4:32:01 PM UTC-7, Andy wrote:

I think I see the problem, the org.elasticsearch.river.jdbc.ValueSet
class is wiping out my id.

For example,

    ValueSet firstRow = new ValueSet(null, "person1");
    System.out.println(firstRow);
    ValueSet secondRow = new ValueSet(firstRow, "person1");
    System.out.println(secondRow);

The secondRow value array is null.

I'll create a pull request.

--

Hi:

I'm also running into this issue: when exposing '_id' in my query and
trying to construct objects, I end up with the trace described below. When
not using '_id', everything works just fine.

Thanks!

For reference, the encountered trace is:

org.elasticsearch.common.jackson.JsonGenerationException: Can not write a
field name, expecting a value
at
org.elasticsearch.common.jackson.impl.JsonGeneratorBase._reportError(JsonGeneratorBase.java:480)
at
org.elasticsearch.common.jackson.impl.Utf8Generator.writeFieldName(Utf8Generator.java:270)
at
org.elasticsearch.common.xcontent.json.JsonXContentGenerator.writeFieldName(JsonXContentGenerator.java:73)
at
org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.java:262)
at org.elasticsearch.river.jdbc.Merger.build(Merger.java:313)
at org.elasticsearch.river.jdbc.Merger.flush(Merger.java:226)
at org.elasticsearch.river.jdbc.Merger.row(Merger.java:195)
at org.elasticsearch.river.jdbc.SQLService.processRow(SQLService.java:771)
at org.elasticsearch.river.jdbc.SQLService.nextRow(SQLService.java:191)
at
org.elasticsearch.river.jdbc.JDBCRiver$JDBCConnector.run(JDBCRiver.java:201)
at java.lang.Thread.run(Thread.java:680)

--

Warm thanks to all for trying the JDBC river!

A note, I would welcome you to enter the issues into the github issue
tracker at https://github.com/jprante/elasticsearch-river-jdbc so I can
make substantial progress on them - the next version is overdue. Pull
requests, patches, test cases, wiki docs are very welcome!

Cheers,

Jörg

On Thursday, November 15, 2012 1:23:50 PM UTC+1, cubic1271 wrote:

Hi:

I'm also running into this issue: when exposing '_id' in my query and
trying to construct objects, I end up with the trace described below. When
not using '_id', everything works just fine.

Thanks!

For reference, the encountered trace is:

org.elasticsearch.common.jackson.JsonGenerationException: Can not write a
field name, expecting a value
at
org.elasticsearch.common.jackson.impl.JsonGeneratorBase._reportError(JsonGeneratorBase.java:480)
at
org.elasticsearch.common.jackson.impl.Utf8Generator.writeFieldName(Utf8Generator.java:270)
at
org.elasticsearch.common.xcontent.json.JsonXContentGenerator.writeFieldName(JsonXContentGenerator.java:73)
at
org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.java:262)
at org.elasticsearch.river.jdbc.Merger.build(Merger.java:313)
at org.elasticsearch.river.jdbc.Merger.flush(Merger.java:226)
at org.elasticsearch.river.jdbc.Merger.row(Merger.java:195)
at org.elasticsearch.river.jdbc.SQLService.processRow(SQLService.java:771)
at org.elasticsearch.river.jdbc.SQLService.nextRow(SQLService.java:191)
at
org.elasticsearch.river.jdbc.JDBCRiver$JDBCConnector.run(JDBCRiver.java:201)
at java.lang.Thread.run(Thread.java:680)

--

Will do. Thanks much!

On Thursday, November 15, 2012 8:56:07 AM UTC-5, Jörg Prante wrote:

Warm thanks to all for trying the JDBC river!

A note, I would welcome you to enter the issues into the github issue
tracker at https://github.com/jprante/elasticsearch-river-jdbc so I can
make substantial progress on them - the next version is overdue. Pull
requests, patches, test cases, wiki docs are very welcome!

Cheers,

Jörg

On Thursday, November 15, 2012 1:23:50 PM UTC+1, cubic1271 wrote:

Hi:

I'm also running into this issue: when exposing '_id' in my query and
trying to construct objects, I end up with the trace described below. When
not using '_id', everything works just fine.

Thanks!

For reference, the encountered trace is:

org.elasticsearch.common.jackson.JsonGenerationException: Can not write a
field name, expecting a value
at
org.elasticsearch.common.jackson.impl.JsonGeneratorBase._reportError(JsonGeneratorBase.java:480)
at
org.elasticsearch.common.jackson.impl.Utf8Generator.writeFieldName(Utf8Generator.java:270)
at
org.elasticsearch.common.xcontent.json.JsonXContentGenerator.writeFieldName(JsonXContentGenerator.java:73)
at
org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.java:262)
at org.elasticsearch.river.jdbc.Merger.build(Merger.java:313)
at org.elasticsearch.river.jdbc.Merger.flush(Merger.java:226)
at org.elasticsearch.river.jdbc.Merger.row(Merger.java:195)
at org.elasticsearch.river.jdbc.SQLService.processRow(SQLService.java:771)
at org.elasticsearch.river.jdbc.SQLService.nextRow(SQLService.java:191)
at
org.elasticsearch.river.jdbc.JDBCRiver$JDBCConnector.run(JDBCRiver.java:201)
at java.lang.Thread.run(Thread.java:680)

--