# Log stash schema less input fields

**URL:** <https://discuss.elastic.co/t/log-stash-schema-less-input-fields/265681>\
**Category:** Logstash\
**Created:** [February 27, 2021, 6:23am UTC](https://discuss.elastic.co/t/log-stash-schema-less-input-fields/265681 "2021-02-27T06:23:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ali\_ghorbani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ali_ghorbani/32/84372_2.png) [@ali\_ghorbani](https://discuss.elastic.co/u/ali_ghorbani)\
**Post date:** [February 27, 2021, 6:23am UTC](https://discuss.elastic.co/t/log-stash-schema-less-input-fields/265681/1 "2021-02-27T06:23:17Z")

</div>

Hi,  
I'm new in log-stash what I trying to do is to store my request and response JSON of my web app into the elastic search using log-stash with no change in their JSON format.  
the problem is a field named start\_time is long in some APIs and string in others which causes the following error by log-stash and data loss in elastic search.

```auto
[WARN] 2021-02-24 11:30:30.071 [[main]>worker2] elasticsearch - Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"logstash", :routing=>nil, :_type=>"_doc"}, #<LogStash::Event:0x6c703a1d>], :response=>{"index"=>{"_index"=>"logstash", "_type"=>"_doc", "_id"=>"AuAN03cBCS4Qzugpwaws", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [data.payload.keepers.start_time] of type [long] in document with id 'AuAN03cBCS4Qzugpwaws'. Preview of field's value: '01/01/1399'", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"For input string: \"01/01/1399\""}}}}}

```

and this is my config file:

```auto
input {
  file {
    path => "/home/ali/logstash/1.log"
  }
}
filter{
  json {
    source => "message"
    remove_field => ["message"]
  }
}
output {
    elasticsearch {
        hosts => [" *****"]
        user => " ****"
        password => " ****"
    }
}

```

how can i force the log-stash to use schema-less records? I'm really appreciate helps in details.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 27, 2021, 4:41pm UTC](https://discuss.elastic.co/t/log-stash-schema-less-input-fields/265681/2 "2021-02-27T16:41:49Z")

</div>

The issue is in elasticsearch, not logstash. A field can only have one type. If you have [dynamic mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-mapping.html) enabled then the first document that is indexed determines the field type. You can override that using an [index template](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html).

---

<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:** [March 27, 2021, 4:42pm UTC](https://discuss.elastic.co/t/log-stash-schema-less-input-fields/265681/3 "2021-03-27T16:42:17Z")

</div>

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