# Synonyms containing commas

**URL:** <https://discuss.elastic.co/t/synonyms-containing-commas/160504>\
**Category:** Elasticsearch\
**Created:** [December 12, 2018, 9:11am UTC](https://discuss.elastic.co/t/synonyms-containing-commas/160504 "2018-12-12T09:11:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mags107](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@mags107](https://discuss.elastic.co/u/mags107)\
**Post date:** [December 12, 2018, 9:11am UTC](https://discuss.elastic.co/t/synonyms-containing-commas/160504/1 "2018-12-12T09:11:34Z")

</div>

When updating a synonym list via the API, not using a synonym text file. We have a synonym list that has values that contain commas causes a json parsing error if the normal escape sequence is used e.g. , Given that the synonyms are a comma separated list, without the escape sequence it makes the list wrong. If I escape the backslash is this the correct approach, ie. \,

What is the correct approach to this problem?

---

<div class="post-metadata">

**Author:** ![zz\_hello](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zz\_hello](https://discuss.elastic.co/u/zz_hello)\
**Post date:** [December 12, 2018, 10:31am UTC](https://discuss.elastic.co/t/synonyms-containing-commas/160504/2 "2018-12-12T10:31:44Z")

</div>

is your synonyms list look like this? or you means your synonyms have commas except the separated comma.

"synonyms": [  
"british,english",  
"queen,monarch"  
]

---

<div class="post-metadata">

**Author:** ![mags107](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@mags107](https://discuss.elastic.co/u/mags107)\
**Post date:** [December 12, 2018, 11:49am UTC](https://discuss.elastic.co/t/synonyms-containing-commas/160504/3 "2018-12-12T11:49:11Z")

</div>

The original I've have is something like this:  
"synonyms": [  
"£2\,000 =\> £2\,000, £2000",  
"queen =\> queen, monarch"  
]  
However Elastic complains it doesn't recognise the escape sequence. I assumed that if I put in "£2\\,000", that would work, as obviously if I remove the backslash completely it will assume my synonyms are £2 and 000 and £2000; which is clearly not what I need.

---

<div class="post-metadata">

**Author:** ![zz\_hello](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zz\_hello](https://discuss.elastic.co/u/zz_hello)\
**Post date:** [December 13, 2018, 2:18am UTC](https://discuss.elastic.co/t/synonyms-containing-commas/160504/4 "2018-12-13T02:18:21Z")

</div>

i tried with my es6.x and this way get the right answer , "£2\\,000 =\> £2\\,000, £2000"  
it 's exactly what you want.

---

<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 10, 2019, 2:18am UTC](https://discuss.elastic.co/t/synonyms-containing-commas/160504/5 "2019-01-10T02:18:22Z")

</div>

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