elasticsearch-net icon indicating copy to clipboard operation
elasticsearch-net copied to clipboard

Bool-Query with many must-Clauses needed

Open FrankAppGenerics opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. I need a solution to write a nest query which should have the following result:

"bool": {
	"must": [
		{
			"term": {
				"documentTags.value": {
					"value": "searchvalue1",
					"case_insensitive": true
				}
			}
		}
	],
	"must": [
		{
			"term": {
				"documentTags.value": {
					"value": "searchvalue2",
					"case_insensitive": true
				}
			}
		}
	]
}

I've tried many different ways, but NEST seems to optimize this always to:

"bool": {
	"must": [
		{
			"term": {
				"documentTags.value": {
					"value": "searchvalue1",
					"case_insensitive": true
				}
			}
		},
		{
			"term": {
				"documentTags.value": {
					"value": "searchvalue2",
					"case_insensitive": true
				}
			}
		}
	]
}

The query does not deliver the same result used in a nested query.

Describe the solution you'd like A way to construct the above mentioned query.

FrankAppGenerics avatar May 29 '22 20:05 FrankAppGenerics