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

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.

{
	"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:

  "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.

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