Question about sub-field:value query

Hello,

I am currently working on snapshots for some indices in my cluster. I am planning to store _status query result into an index in elasticsearch after the snapshot job is completed.

a part of _status results are as below.

Is there a query to parse “server-metrics” as a value (highlighted as bold below)?
It is a properties of “indices” and I guess the query I am looking for might be different from getting 0 value from "indices.server-metrics.shards_stats.initializing" field.

Please advise.

{
"snapshots" : [
{
...
"indices" : {
"server-metrics" : {
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},

}
}
}
]
}

Thanks!

I solved this problem by setting ingest pipeline for adding the target value as separate kv.

Is there anyone know how I can directly query above value (without adding ingest pipeline), please let me know.

thanks!