# Filter synonym not working

**URL:** <https://discuss.elastic.co/t/filter-synonym-not-working/242868>\
**Category:** Elasticsearch\
**Created:** [July 28, 2020, 9:19am UTC](https://discuss.elastic.co/t/filter-synonym-not-working/242868 "2020-07-28T09:19:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggiff](https://avatars.discourse-cdn.com/v4/letter/g/9dc877/32.png) [@ggiff](https://discuss.elastic.co/u/ggiff)\
**Post date:** [July 28, 2020, 9:19am UTC](https://discuss.elastic.co/t/filter-synonym-not-working/242868/1 "2020-07-28T09:19:15Z")

</div>

I am using ingest processor to ingest/index files like pdf, xls etc.  
This is my pipeline:

```auto
curl -XPUT 'ES_HOST:ES_PORT/_ingest/pipeline/attachment?pretty' -H 'Content-Type: application/json' -d '{
 "description" : "Extract attachment information encoded in Base64 with UTF-8 charset",
 "processors" : [
   {
     "attachment" : {
       "field" : "data",
       "properties": ["content", "content_type"]
     }
   },
   {"remove": {
      "field": "data"
    }
  }
 ]
}

```

Then I define the doc\_poc\_syn index and add a custom analyzer to try the synonym feature:

```auto
PUT /doc_poc_syn
{
  "mappings": {
    "properties": {
      "attachment.content": {
        "type": "text"
      }
    }
  },
  "settings": {
    "index": {
      "analysis": {
         "analyzer": {
          "my_analyzer": {
            "tokenizer": "standard",
            "filter": ["my_synonym"]
          }
        },
        "search_analyzer": {
          "my_analyzer": {
            "tokenizer": "standard",
            "filter": ["my_synonym"]
          }
        },
        "filter": {
          "my_synonym": {
            "type": "synonym",
            "synonyms": [
              "pandemic, covid"
            ]
          }
        }
      }
    }
  }
}

```

(The search analyzer should be redundant if I am not wrong)

```auto
POST doc_poc_syn/_analyze
{
  "analyzer": "my_analyzer",
  "text": "pandemic"
}

```

returns as expected but if I run

```auto
GET /_search
{
  "query": {
    "match": {
      "attachment.content": {
        "query": "pandemic"
    }
  }
}}

```

I don't get any results. Instead If I use "covid" a document that added comes up. Any clue?

Thanks!

---

<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:** [August 25, 2020, 9:19am UTC](https://discuss.elastic.co/t/filter-synonym-not-working/242868/2 "2020-08-25T09:19:18Z")

</div>

Closed on August 25, 2020, 9:19am UTC

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