# How logstash change the id to custom with kv

**URL:** <https://discuss.elastic.co/t/how-logstash-change-the-id-to-custom-with-kv/124189>\
**Category:** Logstash\
**Created:** [March 16, 2018, 2:55am UTC](https://discuss.elastic.co/t/how-logstash-change-the-id-to-custom-with-kv/124189 "2018-03-16T02:55:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zqc0512](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zqc0512/32/32141_2.png) [@zqc0512](https://discuss.elastic.co/u/zqc0512)\
**Post date:** [March 16, 2018, 2:55am UTC](https://discuss.elastic.co/t/how-logstash-change-the-id-to-custom-with-kv/124189/1 "2018-03-16T02:55:25Z")

</div>

with kv configure  
now in kibana the data is like  
\_source": {  
"1": "1",  
"2": "0",  
"3": "0",  
"4": "0",  
"5": "1",  
"6": "0",  
"7": "1",  
"8": "0",  
"9": "0",  
"10": "0",  
"11": "0",  
"12": "0",  
"13": "0",  
"14": "0",  
"15": "0",  
**"16": "0",**  
"code": "1=1 2=0 3=0 4=0 5=1 6=0 7=1 8=0 9=0 10=0 11=0 12=0 13=0 14=0 15=0 16=0",

how change the **"16": "0", to "testname": "0"** , not use the id use the custom name  
it change in logstash configure file or with es mapping ?  
how can do it thanks.  
@Christian_Dahlqvist  
@warkolm

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 16, 2018, 6:30pm UTC](https://discuss.elastic.co/t/how-logstash-change-the-id-to-custom-with-kv/124189/2 "2018-03-16T18:30:08Z")

</div>

> [@zqc0512](#):
>
> how can do it thanks.
> 
> @Christian_Dahlqvist
> 
> @warkolm

Please don't ping people like this, if you have a question then please be patient.

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [March 17, 2018, 4:42am UTC](https://discuss.elastic.co/t/how-logstash-change-the-id-to-custom-with-kv/124189/3 "2018-03-17T04:42:22Z")

</div>

I imagine renaming the appropriate fields using the [mutate filter's rename command](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-rename) would be your best bet here:

```auto
# ...
filter {
  # ...
  mutate {
    rename => {
      "1" => "somename"
      "2" => "anothername"
      # ...
      "16" => "testname"
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![zqc0512](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zqc0512/32/32141_2.png) [@zqc0512](https://discuss.elastic.co/u/zqc0512)\
**Post date:** [March 19, 2018, 12:49am UTC](https://discuss.elastic.co/t/how-logstash-change-the-id-to-custom-with-kv/124189/4 "2018-03-19T00:49:22Z")

</div>

the data is in kv  
mutate source is kv? or kv add a tage test mutate source is test?  
thanks  
@yaauie

---

<div class="post-metadata">

**Author:** ![zqc0512](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zqc0512/32/32141_2.png) [@zqc0512](https://discuss.elastic.co/u/zqc0512)\
**Post date:** [March 19, 2018, 12:50am UTC](https://discuss.elastic.co/t/how-logstash-change-the-id-to-custom-with-kv/124189/5 "2018-03-19T00:50:03Z")

</div>

soory i will know it.

---

<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:** [April 16, 2018, 12:50am UTC](https://discuss.elastic.co/t/how-logstash-change-the-id-to-custom-with-kv/124189/6 "2018-04-16T00:50:09Z")

</div>

Closed on April 16, 2018, 12:50am UTC

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