Exists query for field that has only 1 nested child not working

Trying to query entries based on a mapping like this:

{"top":
{
"properties":
{
"doc": {
            "properties": {
             "A": {
                "properties": {
                  "B": {
                    "type": "nested",
                    "dynamic": "strict",
                    "properties": {
                      "C": {
                        "type": "keyword"
                      },
                      "D": {
                        "type": "keyword"
                      },                      
                    }
                  }
                }
              }
            }
          }
}
}

with a query like this:

{"query":{"bool":{"filter":[{"exists":{"field":"top.doc.A" }}]}}, "from":0,"size":1000,"sort":[{"Name":{"order":"asc"}}],"track_total_hits":true}

and don't get hits but if I try:

{"query":{"bool":{"filter":[{"exists":{"field":"top.doc" }}]}}, "from":0,"size":1000,"sort":[{"Name":{"order":"asc"}}],"track_total_hits":true}

I get the entries that I know I have. What am I doing wrong ?

Welcome!

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script is something anyone can copy and paste in Kibana dev console, click on the run button to reproduce your use case. It will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.