# Issue with the indices field of elasticsearch output

**URL:** <https://discuss.elastic.co/t/issue-with-the-indices-field-of-elasticsearch-output/69554>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [December 20, 2016, 10:36am UTC](https://discuss.elastic.co/t/issue-with-the-indices-field-of-elasticsearch-output/69554 "2016-12-20T10:36:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![YLombardi](https://avatars.discourse-cdn.com/v4/letter/y/43a26b/32.png) [@YLombardi](https://discuss.elastic.co/u/YLombardi)\
**Post date:** [December 20, 2016, 10:36am UTC](https://discuss.elastic.co/t/issue-with-the-indices-field-of-elasticsearch-output/69554/1 "2016-12-20T10:36:09Z")

</div>

I'm trying to send my logs to multiple indices based on a field value.  
In the documentation, it says that I can do this by using the "indices" field in the elasticsearch output : [https://www.elastic.co/guide/en/beats/filebeat/5.0/elasticsearch-output.html#\_indices](https://www.elastic.co/guide/en/beats/filebeat/5.0/elasticsearch-output.html#_indices)

To tests this, I add to my filebeat.yml :  
indices:  
- index: "critical-%{+yyyy.MM.dd}"  
when.contains:  
message: "CRITICAL"  
- index: "error-%{+yyyy.MM.dd}"  
when.contains:  
message: "ERR"

Now I restart filebeat and it fails with this error :  
Exiting: error loading config file: yaml: line 313: found character that cannot start any token

Line 313 is the line where I add the "indices" field.  
I don't find what error I did. I just copy/paste the exemple from the documentation.

Can someone help me with this ?

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [December 20, 2016, 11:42am UTC](https://discuss.elastic.co/t/issue-with-the-indices-field-of-elasticsearch-output/69554/2 "2016-12-20T11:42:14Z")

</div>

the YAML parser is failing on your configuration. YAML is sensitive to indentation. The config file by default uses 2 spaces per level.

You can test your yaml with [http://www.yamllint.com](http://www.yamllint.com) .

Please format configs using the `</>`-button. Having a syntax error in your config, we will need to see the complete config.

---

<div class="post-metadata">

**Author:** ![YLombardi](https://avatars.discourse-cdn.com/v4/letter/y/43a26b/32.png) [@YLombardi](https://discuss.elastic.co/u/YLombardi)\
**Post date:** [December 20, 2016, 12:44pm UTC](https://discuss.elastic.co/t/issue-with-the-indices-field-of-elasticsearch-output/69554/3 "2016-12-20T12:44:33Z")

</div>

Thanks, that was that. An indentation error.  
Now it works.

---

<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:** [January 17, 2017, 12:44pm UTC](https://discuss.elastic.co/t/issue-with-the-indices-field-of-elasticsearch-output/69554/4 "2017-01-17T12:44:40Z")

</div>

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