Multilevel Nested Query with different nested paths


(elastic) #1

Hello,

This question is in response to an earlier question thats closed now. @ cbuescher

My query is a little similar, but i need to search on two different nested paths.

Query:

POST /nested_test/t/_search
{
	"query": {
		"nested": {
			"path": "categories",
			"query": {
				"nested": {
					"path": "categories.list",
					"query": {
						"nested": {
							"path": "categories.list.persons.details",
							"query": {
								"bool": {
									"must": [
										{
											"match": {
												"categories.list.persons.details.person_id": 1
											}
										},
										{
											"match": {
												"categories.list.url_site": "www.bla.org"
											}
										}
									]
								}
							}
						}
					}
				}
			}
		}
	}
}

note that i need to match for persion_id and url_site.
But this query does not give me any hits.
I have searched through a lot, but all multi-level nested query examples i have come accross, only query on fields on same path and not on different paths as my query is.
Thanks.


(system) #2

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