Multiple search clauses and filtering?

Hello.

I'm trying to search trough my items and I'm trying to achieve a combination of a wildcard search and an exact match on two different fields and finally filtering out the results.

My current request looks like this:

{
	"query": {
		"bool": {
			"must": {
				"wildcard": {
					"name": "*leje*"
				}
			},
			"should": [
								{ "match": { "sku": "leje"   }}

			],
			"filter": [
				{
					"term": {
						"tenant": "specificshop"
					}
				}
			]
		}
	}
}

I'm getting the results filtered correctly and I'm also getting documents that matches the wildcard search, but the document that has a sku with the exact value doesn't show up.

I'm probably misunderstanding the usage of something, but I can't seem to figure out what I'm doing wrong.

Any input is appreciated.

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