Secondary Index on the presence of an optional message field

First of all, sorry for the basic question, but this was not clear to me from the documentation. If I have a top-level message/record with optional message fields (e.g. in a oneof)

message TopLevel {
   <other fields>
   message A {}
   message B {}
   message C {}
   oneof subtype {
     A a = n;
     B b = n+1;
     C c = n+2;

and I wanted to support a Query like (e.g. in Java)

                <some condition on other fields>,

with a secondary index, would I merely create a value type index on the field like below?

metadataBuilder.addIndex("TopLevel", new Index("TopLevel$a", field("a"), IndexTypes.VALUE));

I.e. is the proto bytestring U null indexed in this case?

P.s. I noticed that there is an Index constructor that takes a valueExpression argument, but no documentation is provided.