# Synonyms disappear, once I restart server

**URL:** <https://discuss.elastic.co/t/synonyms-disappear-once-i-restart-server/13210>\
**Category:** Elasticsearch\
**Created:** [August 14, 2013, 4:33am UTC](https://discuss.elastic.co/t/synonyms-disappear-once-i-restart-server/13210 "2013-08-14T04:33:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prasanth\_Nair](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prasanth_nair/32/2102_2.png) [@Prasanth\_Nair](https://discuss.elastic.co/u/Prasanth_Nair)\
**Post date:** [August 14, 2013, 4:33am UTC](https://discuss.elastic.co/t/synonyms-disappear-once-i-restart-server/13210/1 "2013-08-14T04:33:48Z")

</div>

Hello All

I'm new to ES (as new as 4 days), I'm facing a problem with my sysnonym  
implementation vanishing after I restart my server (default server config).  
I'm on mac OS

I did a mapping like

1. curl -XPOST '_[http://localhost:9200/countr](http://localhost:9200/countr)_y' -d @mappings.json

\<\>  
{  
"mappings": {  
"country": {  
"properties": {  
"status": {  
"type": "string"  
},  
"id": {  
"type": "long"  
},  
"name": {  
"type": "string",  
"analyzer": "syns"  
}  
}  
}  
},  
"settings": {  
"analysis": {  
"filter": {  
"syns\_filter": {  
"synonyms\_path": "synonyms/wordnet\_syn.txt",  
"type": "synonym"  
}  
},  
"analyzer": {  
"syns": {  
"filter": [  
"standard",  
"lowercase",  
"syns\_filter"  
],  
"type": "custom",  
"tokenizer": "standard"  
}  
}  
}  
}  
}

##########################################  
curl -XGET '_[http://localhost:9200/country/\_mapping](http://localhost:9200/country/_mapping)_?pretty=1'  
{  
"country" : {  
"jdbc" : {  
"properties" : {  
"name" : {  
"type" : "string"  
}  
}  
},  
"country" : {  
"properties" : {  
"id" : {  
"type" : "long"  
},  
"name" : {  
"type" : "string",  
"analyzer" : "syns"  
},  
"status" : {  
"type" : "string"  
}  
}  
}  
}  
}

#######################################################################################

# create river

#######################################################################################

curl -XPUT 'localhost:9200/\_river/ay\_dev\_jdbc\_river/\_meta' -d '{  
"type" : "jdbc",  
"jdbc" : {  
"strategy" : "simple",  
"driver" : "com.mysql.jdbc.Driver",  
"url" : "jdbc:mysql://localhost:3306/xyz",  
"user" : "root",  
"password" : "",  
"poll" : "3h",  
"max\_retries" : 3,  
"max\_retries\_wait" : "10s",  
"sql" : "select id as \_id, name, status from master\_countries"  
},  
"index" : {  
"index" : "country",  
"type" : "jdbc",  
"bulk\_size" : 100,  
"max\_bulk\_requests" : 30,  
"bulk\_timeout" : "60s"  
}  
}'

Test curl -XGET 'localhost:9200/country/\_search?pretty&q=\*' (WORKS FINE)

##### synonym file content

russia, ussr=\>russian federation  
uk, britain=\>united kingdom  
usa, america=\>united states

Till now everything worked fine, and if I query like  
[http://127.0.0.1:9200/country/\_search?pretty=1&q=name:"uk"](http://127.0.0.1:9200/country/_search?pretty=1&q=name:%22uk%22)

I get the right output with synonym in it... But once I restart server I  
dont see synonyms getting included though \_mapping still shows right  
mapping.

Thanks for helping me with your thoughts

cheers!  
prash

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Prasanth\_Nair](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prasanth_nair/32/2102_2.png) [@Prasanth\_Nair](https://discuss.elastic.co/u/Prasanth_Nair)\
**Post date:** [August 15, 2013, 3:10am UTC](https://discuss.elastic.co/t/synonyms-disappear-once-i-restart-server/13210/2 "2013-08-15T03:10:50Z")

</div>

Figured out a work around by adding analyzer to query  
[http://127.0.0.1:9200/country/\_search?pretty=1&q=name:"uk"&analyzer=syns](http://127.0.0.1:9200/country/_search?pretty=1&q=name:%22uk%22&analyzer=syns)

If there is a 'right / better' way of solving this problem please let me  
know.

thanks  
prash

On Wednesday, August 14, 2013 10:03:48 AM UTC+5:30, Prasanth Nair wrote:

> Hello All
> 
> I'm new to ES (as new as 4 days), I'm facing a problem with my sysnonym  
> implementation vanishing after I restart my server (default server config).  
> I'm on mac OS
> 
> I did a mapping like
> 
> 1. curl -XPOST '\*[http://localhost:9200/countr\*y](http://localhost:9200/countr*y)' -d @mappings.json
> 
> \<\>  
> {  
> "mappings": {  
> "country": {  
> "properties": {  
> "status": {  
> "type": "string"  
> },  
> "id": {  
> "type": "long"  
> },  
> "name": {  
> "type": "string",  
> "analyzer": "syns"  
> }  
> }  
> }  
> },  
> "settings": {  
> "analysis": {  
> "filter": {  
> "syns\_filter": {  
> "synonyms\_path": "synonyms/wordnet\_syn.txt",  
> "type": "synonym"  
> }  
> },  
> "analyzer": {  
> "syns": {  
> "filter": [  
> "standard",  
> "lowercase",  
> "syns\_filter"  
> ],  
> "type": "custom",  
> "tokenizer": "standard"  
> }  
> }  
> }  
> }  
> }
> 
> ##########################################  
> curl -XGET '\*[http://localhost:9200/country/\_mapping\*?pretty=1](http://localhost:9200/country/_mapping*?pretty=1)'  
> {  
> "country" : {  
> "jdbc" : {  
> "properties" : {  
> "name" : {  
> "type" : "string"  
> }  
> }  
> },  
> "country" : {  
> "properties" : {  
> "id" : {  
> "type" : "long"  
> },  
> "name" : {  
> "type" : "string",  
> "analyzer" : "syns"  
> },  
> "status" : {  
> "type" : "string"  
> }  
> }  
> }  
> }  
> }
> 
> #######################################################################################
> 
> # create river
> 
> #######################################################################################
> 
> curl -XPUT 'localhost:9200/\_river/ay\_dev\_jdbc\_river/\_meta' -d '{  
> "type" : "jdbc",  
> "jdbc" : {  
> "strategy" : "simple",  
> "driver" : "com.mysql.jdbc.Driver",  
> "url" : "jdbc:mysql://localhost:3306/xyz",  
> "user" : "root",  
> "password" : "",  
> "poll" : "3h",  
> "max\_retries" : 3,  
> "max\_retries\_wait" : "10s",  
> "sql" : "select id as \_id, name, status from master\_countries"  
> },  
> "index" : {  
> "index" : "country",  
> "type" : "jdbc",  
> "bulk\_size" : 100,  
> "max\_bulk\_requests" : 30,  
> "bulk\_timeout" : "60s"  
> }  
> }'
> 
> Test curl -XGET 'localhost:9200/country/\_search?pretty&q=\*' (WORKS FINE)
> 
> ##### synonym file content
> 
> russia, ussr=\>russian federation  
> uk, britain=\>united kingdom  
> usa, america=\>united states
> 
> Till now everything worked fine, and if I query like  
> [http://127.0.0.1:9200/country/\_search?pretty=1&q=name:"uk"](http://127.0.0.1:9200/country/_search?pretty=1&q=name:%22uk%22)
> 
> I get the right output with synonym in it... But once I restart server I  
> dont see synonyms getting included though \_mapping still shows right  
> mapping.
> 
> Thanks for helping me with your thoughts
> 
> cheers!  
> prash

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:21am UTC](https://discuss.elastic.co/t/synonyms-disappear-once-i-restart-server/13210/3 "2017-07-06T02:21:04Z")

</div>

Closed on July 6, 2017, 2:21am UTC


