Title: Re: synonym token filter
Hello!

This is a part of the mappings you send to Elasticsearch, for example during index creation. The synonyms_path property is relative to the config directory. So if your file is synonym.txt, it should go to $ES_HOME/config and you could send the following command to create an index:

curl -XPOST 'localhost:9200/test' -d '
{
"settings": {
 "index" : {
  "analysis" : {
   "analyzer" : {
    "synonym" : {
     "tokenizer" : "whitespace",
     "filter" : ["synonym"]
    }
   },
   "filter" : {
    "synonym" : {
     "type" : "synonym",
     "synonyms_path" : "synonym.txt"
    }
   }
  }
 }
},
"mappings" : {
 "test" : {
  "properties" : {                
   "name" : { "type" : "string", "index" : "analyzed", "analyzer" : "synonym" }
  }
 }
}
}'

My synonym.txt file had the following contents:
aaa=>bbb

Now to test it, just run the following command:
curl -XGET 'localhost:9200/test/_analyze?analyzer=synonym&text=aaa+test&pretty=true'

And you should get something like this:
{
 "tokens" : [ {
   "token" : "bbb",
   "start_offset" : 0,
   "end_offset" : 3,
   "type" : "SYNONYM",
   "position" : 1
 }, {
   "token" : "test",
   "start_offset" : 4,
   "end_offset" : 8,
   "type" : "word",
   "position" : 2
 } ]
}

So, as you can see it works. Can you check if it works for you?

--
Regards,
Rafał Kuć
Performance Monitoring * Log Analytics * Search Analytics
Solr & Elasticsearch Support *
http://sematext.com/



Hi,

I'm trying to install a synonym token filter for an existing index and having a hard time understanding how this should be done. I've created a synonym.txt file, but I can't understand how to implement the config described in the doc:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-synonym-tokenfilter.html. Is this a file? If so, should it go into the config directory? Or is this supposed to be PUT via curl? None of the things I've tried so far worked. Please help!

Thanks a lot,
Alex
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/d89026ea-aad1-4537-8dac-8ea18a0c6b13%40googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.

--
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/948160320.20131230135159%40alud.com.pl.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to