# Index is not creating

**URL:** <https://discuss.elastic.co/t/index-is-not-creating/115911>\
**Category:** Logstash\
**Created:** [January 17, 2018, 3:37pm UTC](https://discuss.elastic.co/t/index-is-not-creating/115911 "2018-01-17T15:37:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sumit\_Gupta1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit_gupta1/32/22861_2.png) [@Sumit\_Gupta1](https://discuss.elastic.co/u/Sumit_Gupta1)\
**Post date:** [January 17, 2018, 3:37pm UTC](https://discuss.elastic.co/t/index-is-not-creating/115911/1 "2018-01-17T15:37:11Z")

</div>

I' getting following error:

status=\>400,  
: action=\>[  
"index",  
{  
: \_id=\>nil,  
: \_index=\>"mongodata",  
: \_type=\>"mytype1",  
: \_routing=\>nil  
},  
#  
],  
: response=\>{  
"index"=\>{  
"\_index"=\>"mongodata",  
"\_type"=\>"mytype1",  
"\_id"=\>"odSwBGEBmyc6bJc236\_X",  
"status"=\>400,  
"error"=\>{  
"type"=\>"mapper\_parsing\_exception",  
"reason"=\>"Field [\_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."  
}  
}  
}  
}

\_id field is belong to database.

Please suggest.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 21, 2018, 12:06pm UTC](https://discuss.elastic.co/t/index-is-not-creating/115911/2 "2018-01-21T12:06:13Z")

</div>

It looks like the document you're trying to send to ES has a `_id` field which isn't allowed. This is probably caused by a mistake in your configuration.

---

<div class="post-metadata">

**Author:** ![Sumit\_Gupta1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit_gupta1/32/22861_2.png) [@Sumit\_Gupta1](https://discuss.elastic.co/u/Sumit_Gupta1)\
**Post date:** [January 22, 2018, 11:06am UTC](https://discuss.elastic.co/t/index-is-not-creating/115911/3 "2018-01-22T11:06:29Z")

</div>

I'm using DBSCHEMA Jdbc. i'm using following config file. My database has \_id Column. So i used renamed this column in filter script.  
My config file is following:

input{  
jdbc{  
jdbc\_driver\_library =\> "/app/elastic/logstash-6.1.0/lib/dbschema/mongojdbc1.2.jar"  
jdbc\_driver\_class =\> "Java::com.dbschema.MongoJdbcDriver"  
jdbc\_connection\_string =\> "jdbc:mongodb://houbiap5.\*\*\*\*\*\*\*\*\*\*:27017/test"  
jdbc\_user =\> ""  
statement =\> "db.getCollection('EmployeeLoad').find({})"  
}  
}

filter {  
mutate {  
rename =\> { "[\_id]" =\> "documentId" }  
}  
}

output {  
stdout { codec =\> rubydebug }  
elasticsearch {  
hosts =\> ["\*\*\*\*\*\*\*\*\*\*\*\*\*"]  
index =\> 'mongodbschema'  
document\_type =\> "mytype1"  
}  
}

This is giving Following error.

Exception when executing JDBC query {:exception=\>#\<Sequel::DatabaseError: Java::OrgLogstash::MissingConverterException: Missing Converter handling for full class name=org.bson.types.ObjectId, simple name=ObjectId\>}

Please suggest.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 23, 2018, 10:16am UTC](https://discuss.elastic.co/t/index-is-not-creating/115911/4 "2018-01-23T10:16:53Z")

</div>

It looks like there's a column in the result set of the type `ObjectId` that you need to type cast to e.g. a string.

---

<div class="post-metadata">

**Author:** ![Sumit\_Gupta1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sumit_gupta1/32/22861_2.png) [@Sumit\_Gupta1](https://discuss.elastic.co/u/Sumit_Gupta1)\
**Post date:** [January 23, 2018, 6:23pm UTC](https://discuss.elastic.co/t/index-is-not-creating/115911/5 "2018-01-23T18:23:25Z")

</div>

Could you please elaboration this? How can do this.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 23, 2018, 8:39pm UTC](https://discuss.elastic.co/t/index-is-not-creating/115911/6 "2018-01-23T20:39:24Z")

</div>

Change your SQL query to convert the data type of the ObjectId column(s) to varchar or whatever.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 20, 2018, 8:39pm UTC](https://discuss.elastic.co/t/index-is-not-creating/115911/7 "2018-02-20T20:39:36Z")

</div>

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