# Synonyms path vs inline array?

**URL:** <https://discuss.elastic.co/t/synonyms-path-vs-inline-array/57948>\
**Category:** Elasticsearch\
**Created:** [August 12, 2016, 5:23pm UTC](https://discuss.elastic.co/t/synonyms-path-vs-inline-array/57948 "2016-08-12T17:23:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Christensen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevin_christensen/32/11358_2.png) [@Kevin\_Christensen](https://discuss.elastic.co/u/Kevin_Christensen)\
**Post date:** [August 12, 2016, 5:23pm UTC](https://discuss.elastic.co/t/synonyms-path-vs-inline-array/57948/1 "2016-08-12T17:23:08Z")

</div>

In the [documentation for synonyms](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/analysis-synonym-tokenfilter.html) it is recommended to use synonyms\_path instead of a string array in synonyms.

In my environment, file access is not simple, and I plan on updating my synonyms frequently. As such I've decided instead to programmatically fill in the synonyms into the mapping at index update time instead of trying to deal with a file.

Is there a performance reason why not to use synonyms as an array of strings? What are the benefits to using a synonyms file over just putting it directly into the mapping during update?

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 12, 2016, 6:59pm UTC](https://discuss.elastic.co/t/synonyms-path-vs-inline-array/57948/2 "2016-08-12T18:59:26Z")

</div>

Hello Kevin\_Christensen,

By using the inline representation, there will be 2 data structures in memory to represent the same thing (the one from the mapping and the other one parsed inside the token filter itself), so you'll consume more memory.

For large datasets, it is recommended to use the file to reduce memory usage.

Cheers

---

<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:** [July 5, 2017, 10:27pm UTC](https://discuss.elastic.co/t/synonyms-path-vs-inline-array/57948/3 "2017-07-05T22:27:59Z")

</div>


