# Two custom analyzers with the same synonym filter - why no match

**URL:** <https://discuss.elastic.co/t/two-custom-analyzers-with-the-same-synonym-filter-why-no-match/341264>\
**Category:** Elasticsearch\
**Created:** [August 21, 2023, 2:17pm UTC](https://discuss.elastic.co/t/two-custom-analyzers-with-the-same-synonym-filter-why-no-match/341264 "2023-08-21T14:17:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lukas\_Cern](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_cern/32/124791_2.png) [@Lukas\_Cern](https://discuss.elastic.co/u/Lukas_Cern)\
**Post date:** [August 21, 2023, 2:17pm UTC](https://discuss.elastic.co/t/two-custom-analyzers-with-the-same-synonym-filter-why-no-match/341264/1 "2023-08-21T14:17:23Z")

</div>

I have index with two fields. Each field uses different custom analyzer. Each of those analyzers use the same synonym filter. When querying with bool + should + match on both fields, it matches no document. I dont understand why, because the document contains the synonym in the queryed field.

```auto
{
	"mappings": {
		"properties": {
			"content": {
				"type": "text",
				"analyzer": "my_analyzer"
			},
			"description": {
				"type": "text",
				"analyzer": "my_analyzer1"
			}
		}
	},
	"settings": {
		"index": {
			"number_of_replicas": 0
		},
		"analysis": {
			"filter": {
				"my_synonyms": {
					"type": "synonym",
					"lenient": true,
					"synonyms": ["xxx, yyy => xxx, yyy"]
				}
			},
			"analyzer": {
				"my_analyzer": {
					"type": "custom",
					"tokenizer": "standard",
					"filter": [
						"my_synonyms"
					]
				},
				"my_analyzer1": {
					"type": "custom",
					"tokenizer": "standard",
					"filter": [
						"my_synonyms"
					]
				}
			}
		}
	}
}

```

POST /my-index/\_doc  
{  
"content":"aaa",  
"description":"xxx"  
}

POST /my-index/\_explain/doc\_id  
{"query":{"bool":{"should":[  
{"match":{"content":{"query":"xxx"}}},  
{"match":{"description":{"query":"xxx"}}}  
],"minimum\_should\_match": 1}}}

responds: matched":false, no matching term  
---why? description:"xxx" should match

POST /my-index/\_explain/doc\_id  
{"query":{"bool":{"should":[  
{"match":{"content":{"query":"somethingdifferent"}}},  
{"match":{"description":{"query":"xxx"}}}  
],"minimum\_should\_match": 1}}}

responds: "matched":true

why the first query doesnt match and the second yes? why the value "xxx" is so special when queryed in both fields?

my version:

```auto
  "version" : {
    "number" : "8.7.0",
    "lucene_version" : "9.5.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },

```

Thank you for explanation.

---

<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:** [September 18, 2023, 2:18pm UTC](https://discuss.elastic.co/t/two-custom-analyzers-with-the-same-synonym-filter-why-no-match/341264/2 "2023-09-18T14:18:09Z")

</div>

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