Search with synonym analyzer
<p>Below is the mapping i have used</p>

<pre><code>"analysis": {
          "filter": {
            "synonym": {
              "type": "synonym",
              "synonyms_path": "D:\\MyElasticSearch\\elasticsearch-1.5.2\\config\\synonymsnew.txt",
              "ignore_case": "true"
            },
</code></pre>

<p>in this synonym file i have syonyms for <strong>oil ,filter and engine</strong> </p>

<p>oil, lubricate, lube</p>

<p>engine, motor, machine</p>

<p>filter, strainer, sifter</p>

<p>and here is my mapping</p>

<pre><code>"ExtDesc": {
  "type": "string",
  "index": "analyzed",
  "index_analyzer": "synonym",
  "search_analyzer": "synonym",
  "fields": {
     "raw": {
        "type": "string"
     }
  },
  "copy_to": ["sym_words","did_you_mean"] 
</code></pre>

<p>now when I search with term <strong>cleaners</strong> for this term there are no synonyms declared in the synonyms file.</p>

<p>when I search with the following query over all fields m getting hits null ,even though I have documents with cleaners text</p>

<pre><code>GET synonympcdb3/_search
{
  "query": {
    "match": {
      "sym_words": {
        "query": "cleaners",
        "analyzer": "synonym"
      }
    }
  }
}
</code></pre>