Keyword Query Does not Work

Thank you again @Mark_Harwood.
According to your response, I changed my mapping.
New Mapping

{
	"favoritesearchsearchmodelindex_2": {
		"mappings": {
			"favoritesearchsearchmodel": {
				"properties": {
					"searchQuery": {
						"type": "nested",
						"properties": {
							"categoryProperties": {
								"properties": {
									"key": {
										"type": "keyword"
									},
									"numberValue": {
										"type": "double"
									},
									"values": {
										"properties": {
											"value": {
												"type": "keyword"
											}
										}
									}
								}
							},
							"keyList": {
								"properties": {
									"value": {
										"type": "keyword"
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

After changing mapping i realized that;
I'm searching for searchQuery.categoryProperties.key is not color. I have an array and if one of the key is not colorits ok for search, but not for me.
I created a keyList array and put all grouped keys of searchQuery.categoryProperties.key to keyListobject.
Now I'm searching for keyListfirst. It gives me the correct response. This resolved my problem.

Here is the correct REQUEST

{
	"query": {
		"bool": {
			"must": [{
				"nested": {
					"query": {
						"bool": {
							"filter": [{
								"bool": {
									"should": [{
										"bool": {
											"must_not": [{
												"term": {
													"searchQuery.keyList.value": {
														"value": "color"
													}
												}
											}]
										}
									},
									{
										"bool": {
											"must": [{
												"term": {
													"searchQuery.categoryProperties.key": {
														"value": "color"
													}
												}
											},
											{
												"term": {
													"searchQuery.categoryProperties.values.value": {
														"value": "Mavi"
													}
												}
											}]
										}
									}]
								}
							}]
						}
					},
					"path": "searchQuery"
				}
			}]
		}
	}
}

With @Mark_Harwood help, i don't need a lot of nested queries!

1 Like