When pushing data in child document getting null pointer exception as id is null

org.elasticsearch.transport.RemoteTransportException: [Abyss][127.0.0.1:9350][indices:data/write/bulk]
Caused by: java.lang.NullPointerException: id must not be null
at java.util.Objects.requireNonNull(Objects.java:228) ~[?:1.8.0_131]
at org.elasticsearch.action.RoutingMissingException.(RoutingMissingException.java:43) ~[elasticsearch-2.3.3.jar:2.3.3]

Moved to #elasticsearch

You probably did not provide the parent id?

my index is like this:

curl -XPUT localhost:9250/assmtdmdcollectn -d '{ "settings": { "number_of_shards" : 10}, "mappings": {"assessmenttransactions": {"properties": {"id": {"type": "integer"},"transactiontype": {"type": "string", "index":"not_analyzed"}, "zone": {"type": "string", "index":"not_analyzed"},"ward": {"type": "string", "index":"not_analyzed"}, "locality": {"type": "string", "index":"not_analyzed"},"ownername": {"type": "string", "index":"not_analyzed"}, "doorno": {"type": "string", "index":"not_analyzed"}, "taxeffectivedate": {"type": "date"}, "transactiondate": {"type": "date"} } }, "installmentdemand": {"_parent": {"type": "assessmenttransactions"},"_routing":{"required":"true"},"properties": {"iddemand":{"type":"integer"},"assessment_transaction": {"type": "integer"}, "installment": {"type": "integer"}, "demand": {"type": "double"}, "totalcollection": {"type": "double"}, "advance": {"type": "double"} } }, "installmentcollectioninfo": {"_parent": {"type": "installmentdemand"},"_routing":{"required": true},"properties" : {"idcollection":{"type":"integer"},"installmentdemandinfo" : {"type": "integer"}, "collectiondate" : {"type": "date"}, "recieptnumber" : {"type": "string", "index":"not_analyzed"}, "amount" : {"type": "integer"} } } } }'

Query for push parent document:

#!/bin/bash

export JDBC_IMPORTER_HOME=/home/rahulroy/softwares/elasticsearch-jdbc-2.3.3.0
export ES_HOME=/home/rahulroy/softwares/elasticsearch-jdbc-2.3.3.0
bin=$JDBC_IMPORTER_HOME/bin
lib=$JDBC_IMPORTER_HOME/lib

echo '
{
"type": "jdbc",
"jdbc": {
"url": "jdbc:postgresql://localhost:5432/Narasaraopet",
"user": "postgres",
"password": "postgres",
"strategy": "standard",
"timezone": "localtime",
"sql": "SELECT id as "_id", id, transactiontype, zone, ward, street,locality,ownersname, doorno, tax_effectivedate, transaction_date FROM egpt_assessment_transactions",
"index": "assmtdmdcollectn",
"type": "assessmenttransactions",
"elasticsearch" : {
"cluster" : "rahulelasticsearch",
"host" : "localhost",
"port" : 9350
}
}
}' | java
-cp "${lib}/*"
-Dlog4j.configurationFile=${bin}/log4j2.xml
org.xbib.tools.Runner
org.xbib.tools.JDBCImporter

Nd child document :
#!/bin/bash

export JDBC_IMPORTER_HOME=/home/rahulroy/softwares/elasticsearch-jdbc-2.3.3.0
export ES_HOME=/home/rahulroy/softwares/elasticsearch-jdbc-2.3.3.0
bin=$JDBC_IMPORTER_HOME/bin
lib=$JDBC_IMPORTER_HOME/lib

echo '
{
"type": "jdbc",
"jdbc": {
"url": "jdbc:postgresql://localhost:5432/Narasaraopet",
"user": "postgres",
"password": "postgres",
"strategy": "standard",
"timezone": "localtime",
"sql": "SELECT assessment_transactions, installment, demand,totalcollection,advance FROM egpt_installment_demand_info ",
"index": "assmtdmdcollectn",
"type": "installmentdemand",
"parent":"assessmenttransactions",
"elasticsearch" : {
"cluster" : "rahulelasticsearch",
"host" : "localhost",
"port" : 9350
}
}
}' | java
-cp "${lib}/*"
-Dlog4j.configurationFile=${bin}/log4j2.xml
org.xbib.tools.Runner
org.xbib.tools.JDBCImporter

While pushing data to child index it is giving that error.please help

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

I know a little about JDBC Importer project. @jprante might probably provide a better support then.

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