Synonyms disappear, once I restart server

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/country' -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'
{
"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"

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.
For more options, visit https://groups.google.com/groups/opt_out.

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

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/country' -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'
{
"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"

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.
For more options, visit https://groups.google.com/groups/opt_out.