# Mutate (like logstash conf) using Python API

**URL:** https://discuss.elastic.co/t/mutate-like-logstash-conf-using-python-api/120197
**Category:** Elasticsearch
**Created:** [February 16, 2018, 2:29pm UTC](https://discuss.elastic.co/t/mutate-like-logstash-conf-using-python-api/120197 "2018-02-16T14:29:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![druzmieres](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/druzmieres/32/25828_2.png) [@druzmieres](https://discuss.elastic.co/u/druzmieres)
#### Post date: [February 16, 2018, 2:29pm UTC](https://discuss.elastic.co/t/mutate-like-logstash-conf-using-python-api/120197/1 "2018-02-16T14:29:30Z")

</div>

Hi,

I know that using logstash conf files you can perform operations like "mutate" so you can add fields to the mapping and then you can apply transformations to these fields. Something like this:

```
mutate {
    add_field => { "startDate" => "2017-04-01"}
  }
  date {
    match => ["startDate", "yyyy-MM-dd"]
    target => "startDate"
    timezone => "UTC"
}    

```

I have a file like this (it has thousands of documents):

```
start|end|max
1234|234|1234
3241|423|6564

```

And I want to add a date field. Is there a way to do the same thing using the Python API?

---

<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 16, 2018, 2:29pm UTC](https://discuss.elastic.co/t/mutate-like-logstash-conf-using-python-api/120197/2 "2018-03-16T14:29:55Z")

</div>

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