如何通过祖先密钥数据存储区获取实体?

I need to get a sub entity from the key of parent. I dont know even if its possible. But what I tried is as following:

public function get_service_details(){
     $datastore = new Google\Cloud\Datastore\DatastoreClient(['projectId' => $this->config->item('google_project_id')]);
     $key = $datastore->key($this->entity_kind);

     $key->ancestor($this->parent_kind, $this->parent_key);
     $server_config_details = $datastore->lookup($key);
     return $server_config_details;
}

and

public function get_service_details(){
     $datastore = new Google\Cloud\Datastore\DatastoreClient(['projectId' => $this->config->item('google_project_id')]);
     $ancestorKey = $datastore->key($this->parent_kind, $this->parent_key);
     $query = $datastore->query()
        ->kind($this->entity_kind)
        ->hasAncestor($ancestorKey);

     $server_config_details = $datastore->runQuery($query);
     return $server_config_details;
}

But in both of the above cases it returned me nothing. Can you please tell me what am I missing?

You can use an ancestor query to find child entities:

For example, this query:

SELECT Floor WHERE __key__ HAS ANCESTOR KEY(Building, 'C')

will return all child entities of kind Floor of the root entity with kind Building and name C:

[Building:C, Floor:1]
[Building:C, Floor:2]

Lookups (as opposed to queries) require that you know the full key ahead of time, so they can't be used to find child entities of a root entity.