# How to parse duplicated keys with different values

**URL:** https://discuss.elastic.co/t/how-to-parse-duplicated-keys-with-different-values/288994
**Category:** Logstash
**Created:** [November 11, 2021, 1:27pm UTC](https://discuss.elastic.co/t/how-to-parse-duplicated-keys-with-different-values/288994 "2021-11-11T13:27:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ddoroshenko](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@ddoroshenko](https://discuss.elastic.co/u/ddoroshenko)
#### Post date: [November 11, 2021, 1:27pm UTC](https://discuss.elastic.co/t/how-to-parse-duplicated-keys-with-different-values/288994/1 "2021-11-11T13:27:40Z")

</div>

Hello!

I'm trying to parse CheckPoint log which contains duplicated keys but with different values.  
For example `... match_id:"555"; match_id:"777"; ...`

When I use kv plugin

```auto
kv {
  source => "message"
  field_split => ";"
  value_split => ":"
  trim_key => " "
}

```

I get something like `match_id: 555, 777`

Is it possible to get result as

```auto
match_id.1: 555
match_id.2: 777

```

and then rename these fields to

```auto
match.id.1: 555
match.id.2: 777

```

?

Thank you 🙂

---

<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: [November 11, 2021, 4:33pm UTC](https://discuss.elastic.co/t/how-to-parse-duplicated-keys-with-different-values/288994/2 "2021-11-11T16:33:32Z")

</div>

Use a ruby filter. Something like [this](https://discuss.elastic.co/t/parsing-an-array-in-ruby/121254/2).

---

<div class="post-metadata">

### Author: ![ddoroshenko](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@ddoroshenko](https://discuss.elastic.co/u/ddoroshenko)
#### Post date: [November 19, 2021, 9:18am UTC](https://discuss.elastic.co/t/how-to-parse-duplicated-keys-with-different-values/288994/3 "2021-11-19T09:18:52Z")

</div>

@Badger thank you for your advice  
I've add this code to the filter

```auto
ruby {
    code => '
      event.get("match_id").each_with_index { |x, i| event.set( "[match][id][#{i}]", x) }
      '
  }

```

And what I see in Kibana

```auto
match.id.0 1970-01-01T00:00:00.555Z
match.id.1 1970-01-01T00:00:00.777Z

```

What could be the problem?

UPD: Reindex solved the problem

---

<div class="post-metadata">

### Author: ![ddoroshenko](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@ddoroshenko](https://discuss.elastic.co/u/ddoroshenko)
#### Post date: [November 19, 2021, 9:33am UTC](https://discuss.elastic.co/t/how-to-parse-duplicated-keys-with-different-values/288994/4 "2021-11-19T09:33:14Z")

</div>

Reindex solved the problem

---

<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: [December 17, 2021, 9:34am UTC](https://discuss.elastic.co/t/how-to-parse-duplicated-keys-with-different-values/288994/5 "2021-12-17T09:34:02Z")

</div>

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