# Elasticsearch index based on source field

**URL:** <https://discuss.elastic.co/t/elasticsearch-index-based-on-source-field/97442>\
**Category:** Logstash\
**Created:** [August 17, 2017, 2:41pm UTC](https://discuss.elastic.co/t/elasticsearch-index-based-on-source-field/97442 "2017-08-17T14:41:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Kovacs](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Robert\_Kovacs](https://discuss.elastic.co/u/Robert_Kovacs)\
**Post date:** [August 17, 2017, 2:41pm UTC](https://discuss.elastic.co/t/elasticsearch-index-based-on-source-field/97442/1 "2017-08-17T14:41:40Z")

</div>

Hi! I would like to know if I could output to a different elasticsearch index based on my logs source field? In the sources I have unique identifiers and I would like to make indexes with these identifiers.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 17, 2017, 7:41pm UTC](https://discuss.elastic.co/t/elasticsearch-index-based-on-source-field/97442/2 "2017-08-17T19:41:34Z")

</div>

Yes, just reference the field name in the elasticsearch output's `index` option.

[https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#logstash-config-field-references](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#logstash-config-field-references)

Also:

> <https://stackoverflow.com/questions/27146032/make-logstash-add-different-inputs-to-different-indices/27147688#27147688>

---

<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:** [September 14, 2017, 7:41pm UTC](https://discuss.elastic.co/t/elasticsearch-index-based-on-source-field/97442/3 "2017-09-14T19:41:51Z")

</div>

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