# Help With Query String Query on Nested Fields

**URL:** <https://discuss.elastic.co/t/help-with-query-string-query-on-nested-fields/111192>\
**Category:** Elasticsearch\
**Created:** [December 11, 2017, 10:48pm UTC](https://discuss.elastic.co/t/help-with-query-string-query-on-nested-fields/111192 "2017-12-11T22:48:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bevikra](https://avatars.discourse-cdn.com/v4/letter/b/f05b48/32.png) [@bevikra](https://discuss.elastic.co/u/bevikra)\
**Post date:** [December 11, 2017, 10:48pm UTC](https://discuss.elastic.co/t/help-with-query-string-query-on-nested-fields/111192/1 "2017-12-11T22:48:27Z")

</div>

Hello,

Here is my Schema,

```
{
	"cmslocal": {
		"mappings": {
			"video": {
				"properties": {
					"assetProps": {
						"properties": {
							"assetType": {
								"type": "string"
							},
							"configPath": {
								"type": "string",
								"fields": {
									"raw": {
										"type": "string",
										"index": "not_analyzed"
									}
								},
								"analyzer": "standard"
							},
							"contentSha1": {
								"type": "string"
							},
							"originalPath": {
								"type": "string",
								"fields": {
									"raw": {
										"type": "string",
										"index": "not_analyzed"
									}
								},
								"analyzer": "standard"
							},
							"path": {
								"type": "string",
								"fields": {
									"raw": {
										"type": "string",
										"index": "not_analyzed"
									}
								},
								"analyzer": "standard"
							},
							"thumbnailPath": {
								"type": "string",
								"fields": {
									"raw": {
										"type": "string",
										"index": "not_analyzed"
									}
								},
								"analyzer": "standard"
							}
						}
					},
					"channel": {
						"type": "string"
					},
					"configProps": {
						"properties": {
							"events": {
								"type": "nested",
								"include_in_root": true,
								"properties": {
									"Desc": {
										"type": "string"
									},
									"Tags": {
										"type": "string"
									},
									"UUID": {
										"type": "string"
									}
								}
							},
							"roiUUID": {
								"type": "string"
							}
						}
					},
					"contentSha1": {
						"type": "string"
					},
					"eventDesc": {
						"type": "string"
					},
					"ext": {
						"type": "string"
					},
					"format": {
						"type": "string"
					},
					"fovProps": {
						"properties": {
							"description": {
								"type": "string"
							},
							"width": {
								"type": "float"
							}
						}
					},
					"locationProps": {
						"type": "nested",
						"properties": {
							"address": {
								"type": "string"
							},
							"city": {
								"type": "string"
							},
							"country": {
								"type": "string"
							},
							"county": {
								"type": "string"
							},
							"location": {
								"type": "geo_point"
							},
							"postcode": {
								"type": "string"
							},
							"state": {
								"type": "string"
							}
						}
					},
					"nodeid": {
						"type": "string"
					},
					"poleHeight": {
						"type": "float"
					},
					"query": {
						"properties": {
							"bool": {
								"properties": {
									"filter": {
										"properties": {
											"term": {
												"properties": {
													"nodeid": {
														"type": "string"
													}
												}
											}
										}
									}
								}
							}
						}
					},
					"retentionPolicy": {
						"type": "string"
					},
					"siteScopeID": {
						"type": "string"
					},
					"tagProps": {
						"type": "nested",
						"properties": {
							"conditions": {
								"type": "string"
							},
							"environment": {
								"type": "string"
							},
							"events": {
								"type": "string"
							},
							"lighting": {
								"type": "string"
							},
							"objects": {
								"type": "string"
							},
							"other": {
								"type": "string"
							},
							"scenes": {
								"type": "string"
							},
							"useCases": {
								"type": "string"
							},
							"weather": {
								"type": "string"
							}
						}
					},
					"test": {
						"type": "string"
					},
					"title": {
						"type": "string"
					},
					"uploadTime": {
						"type": "date",
						"format": "strict_date_optional_time||epoch_millis"
					},
					"videoProps": {
						"properties": {
							"bitrate": {
								"type": "float"
							},
							"datetime": {
								"type": "date",
								"format": "date_hour_minute_second_millis"
							},
							"daySegments": {
								"type": "string"
							},
							"duration": {
								"type": "long"
							},
							"framerate": {
								"type": "float"
							},
							"height": {
								"type": "integer"
							},
							"overlaysOn": {
								"type": "boolean"
							},
							"width": {
								"type": "integer"
							}
						}
					}
				}
			}
		}
	}
}

```

Here is the Sample Record,

```
 {
            "assetProps": {
                "contentSha1": "236c266d1ed430da8469916a915e319392df3929",
                "assetType": "raw",
                "path": "249b7f98-e875-4737-92fb-50bda25c6818",
                "originalPath": "",
                "configPath": "",
                "thumbnailPath": "3fac0e2f-7cbe-4e30-bb4e-121115c5e215"
            },
            "tagProps": {
                "conditions": ["snow","rain","fire"],
                "objects": ["car","crowd","people"],
                "other": [
                    "VaticVideos",
                    "corrected by Tamas Balyi"
                ],
                "scenes": [],
                "useCases": []
            },
            "format": "application/octet-stream",
            "fovProps": {
                "width": 0
            },
            "nodeid": "N02cff165",
        }

```

I could able to do a search on nodeid with an OR operator but the issue is with the nested fields.

here is how I'm doing a nodeId query string.

```
 {
    "query": {
        "query_string": {
            "query": "N02cff165 OR N02cff130",
            "fields": [
                "nodeid"
             ]
        }
    }
}

```

How to I apply the query to get something like this.

"N02cff165 OR N02cff130 AND tagProps.objects = car AND tagProps.objects = people AND tagProps.conditons = snow OR tagProps.conditons = fire.

Does elastics search support Query string on nested objects ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 8, 2018, 10:48pm UTC](https://discuss.elastic.co/t/help-with-query-string-query-on-nested-fields/111192/2 "2018-01-08T22:48:41Z")

</div>

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