Why would the following query builder work in the Google cloud console but not programmatically?

And here is my query from my cpp program
Query: kind {
name: "db-wahalao-users"
}
filter {
composite_filter {
op: AND
filters {
property_filter {
property {
name: "displayName.username"
}
op: EQUAL
value {
string_value: "Obasi"
}
}
}
}
}
order {
property {
name: "createdAt"
}
direction: DESCENDING
}
The right permissions are used, I use a service account. Also, when I do a general query without filtering, I do get the right results. But this indexing by displayName.username does not seem to work only in the program code. Or let me say, it has worked once or twice. Nothing makes sense here.