Bool query to match parent and nested field not working


#1

I have logs like this:

    {
    "status":"InProgress",
    "payload":{
    "sevicename":"abc",
    }
    }

The below query works.

{
	"query":{
		"nested":{
			"path":"payload",
			"filter":{
				"bool":{
					"should":
						[
						      {
							   "term":{
								"payload.serviceName": "abc"
							       }
							}
						],
						"minimum_should_match": 1
					}
				}
			}
		}
	}

But I need to match the status as well. When trying to add the must clause in bool, there are no results.

 "must": [
     {
       "match": {
           "status": {
                  "query": "InProgress"
             }
         }
     }
  ]

How to query the parent field? is it possible to add reverse_nested?


(Russ Cam) #2

@sruthi, please could you format code in your post, using the </> button in the editor. Code blocks retain indentation, are color highlighted and much easier to read.


(system) #3