# How to create a consistent id, base on caseID string

**URL:** <https://discuss.elastic.co/t/how-to-create-a-consistent-id-base-on-caseid-string/200411>\
**Category:** Logstash\
**Created:** [September 20, 2019, 12:22pm UTC](https://discuss.elastic.co/t/how-to-create-a-consistent-id-base-on-caseid-string/200411 "2019-09-20T12:22:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ErikWarming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erikwarming/32/39525_2.png) [@ErikWarming](https://discuss.elastic.co/u/ErikWarming)\
**Post date:** [September 20, 2019, 12:22pm UTC](https://discuss.elastic.co/t/how-to-create-a-consistent-id-base-on-caseid-string/200411/1 "2019-09-20T12:22:57Z")

</div>

I need advise:

Everyday I create a log using logstash input-jdbc to run a SQL query on a readonly\_database. In the log I have a long alpha-numeric caseID and I need a human-friendly id number instead. And this id number needs to be the same every time.

I was thinking there must be a way with a logstash input /filter plugin to lookup a list of known caseID on my ES, get a id from that, and when a new caseID is added, I get the last id+1

The log with caseID and attributes

```
{
caseID: "410a-8f03-317cae7710b676be2496-203b-401b", 
attribute1: "foo"
},
{
caseID: "410a-8f03-317cae7710b676be2496-203b-401b", 
attribute1: "bar"
},
{
caseID: "203b-401b-aaf7-fe7ddb86a6f876be-dfgd-654f", 
attribute1: "foo"
},
{
caseID: "203b-401b-aaf7-fe7ddb86a6f876be-dfgd-654f", 
attribute1: "bar"
},

```

The desired output, and id and caseID is now always linked.

```
{
id:	"1",
caseID: "410a-8f03-317cae7710b676be2496-203b-401b", 
attribute1: "foo"
},
{
id:	"1",
caseID: "410a-8f03-317cae7710b676be2496-203b-401b", 
attribute1: "bar"
},
{
id:	"2",
caseID: "203b-401b-aaf7-fe7ddb86a6f876be-dfgd-654f", 
attribute1: "foo"
},
{
id:	"2",
caseID: "203b-401b-aaf7-fe7ddb86a6f876be-dfgd-654f", 
attribute1: "bar"
},

```

How would you suggest that I attack this problem?

---

<div class="post-metadata">

**Author:** ![ErikWarming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erikwarming/32/39525_2.png) [@ErikWarming](https://discuss.elastic.co/u/ErikWarming)\
**Post date:** [September 20, 2019, 1:39pm UTC](https://discuss.elastic.co/t/how-to-create-a-consistent-id-base-on-caseid-string/200411/2 "2019-09-20T13:39:03Z")

</div>

[elasticsearch filter plugin](https://www.elastic.co/guide/en/logstash/current/plugins-filters-elasticsearch.html) should be used for the lookup for existing caseID and id, but creating the next and saving the results

---

<div class="post-metadata">

**Author:** ![ErikWarming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erikwarming/32/39525_2.png) [@ErikWarming](https://discuss.elastic.co/u/ErikWarming)\
**Post date:** [September 20, 2019, 1:40pm UTC](https://discuss.elastic.co/t/how-to-create-a-consistent-id-base-on-caseid-string/200411/3 "2019-09-20T13:40:25Z")

</div>

I found a solution in SQL, so this remains as a interesting question, but there is no longer a pressing need

---

<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:** [October 18, 2019, 1:40pm UTC](https://discuss.elastic.co/t/how-to-create-a-consistent-id-base-on-caseid-string/200411/4 "2019-10-18T13:40:26Z")

</div>

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