# Logstash throwing error while index data into elastic search

**URL:** <https://discuss.elastic.co/t/logstash-throwing-error-while-index-data-into-elastic-search/142496>\
**Category:** Logstash\
**Created:** [August 1, 2018, 7:53am UTC](https://discuss.elastic.co/t/logstash-throwing-error-while-index-data-into-elastic-search/142496 "2018-08-01T07:53:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sudeendra\_G](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Sudeendra\_G](https://discuss.elastic.co/u/Sudeendra_G)\
**Post date:** [August 1, 2018, 7:53am UTC](https://discuss.elastic.co/t/logstash-throwing-error-while-index-data-into-elastic-search/142496/1 "2018-08-01T07:53:06Z")

</div>

Hello ,  
I got following exception while index data into Elasticsearch using logstash

Could not index event to elasticsearch  
error"=\>{"type"=\>"strict\_dynamic\_mapping\_exception", "reason"=\>"mapping set to strict, dynamic introduction of [caseid] within [globalsearch\_comments] is not allowed"}}}}

i think logstash trying to match the response json with index properties, but logstash response is always lowercase, Is there any way to configure logstash which returns json keys same as index properties ??

> it is working fine if i use lowercase json keys for properties ,while creating the index.

**Following is my json structure to create the index.**

```
        {
       "mappings":{
      "globalsearch_comments":{
         "dynamic":"strict",
         "properties":{
            "CommentID":{
               "type":"integer"
            } ,
            "CaseID":{
               "type":"integer"
            } }
      }
   }
}

```

**Logstash conf file :**

```
        input {
  jdbc { 
    jdbc_connection_string => "jdbc:sqlserver://XXXXXXXX;databaseName=XXXXXX"
    jdbc_user => "XXX"
    jdbc_password => "XXXXX$"
    jdbc_driver_library => "D:\sqljdbc4-4.0.jar"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    statement => "SELECT * FROM dbo.Comments"
    }
  }
filter {
  mutate {
    remove_field => ["@version", "@timestamp"]
  }
}
output {
  stdout { codec => rubydebug}
  elasticsearch {
  "hosts" => "localhost:9200"
  "index" => "globalsearch_comments"
  "document_type" => "globalsearch_comments"
  "document_id" => "%{commentid}"
  }
}

```

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 1, 2018, 8:12am UTC](https://discuss.elastic.co/t/logstash-throwing-error-while-index-data-into-elastic-search/142496/2 "2018-08-01T08:12:10Z")

</div>

It seems like you have set the mappings to be strict, which prevents new fields to be added. I suspect a new column has been added to the `comments` table and as this is picked up due to the `SELECT * FROM comments` statement, it is causing mapping failures.

---

<div class="post-metadata">

**Author:** ![Sudeendra\_G](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Sudeendra\_G](https://discuss.elastic.co/u/Sudeendra_G)\
**Post date:** [August 1, 2018, 9:37am UTC](https://discuss.elastic.co/t/logstash-throwing-error-while-index-data-into-elastic-search/142496/3 "2018-08-01T09:37:14Z")

</div>

thanks for your response, i don't want to add the dynamic properties so i set it strict, but issue was while index data into elastic, logstash returning json with lower case keys always. but while iam creating index i specified uppercase json keys so it failed.

no new columns are added to comments table.

---

<div class="post-metadata">

**Author:** ![Sudeendra\_G](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Sudeendra\_G](https://discuss.elastic.co/u/Sudeendra_G)\
**Post date:** [August 1, 2018, 10:59am UTC](https://discuss.elastic.co/t/logstash-throwing-error-while-index-data-into-elastic-search/142496/4 "2018-08-01T10:59:57Z")

</div>

Hello Christian\_Dahlqvist, i found solution , i just need to mutate each Json key. like  
rename =\> { "commentid" =\> "CommentID" } by default it will return json keys in lowercase only

---

<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:** [August 29, 2018, 11:00am UTC](https://discuss.elastic.co/t/logstash-throwing-error-while-index-data-into-elastic-search/142496/5 "2018-08-29T11:00:01Z")

</div>

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