As in the official documentation:
Although Cloud Firestore can store arrays, it does not support querying array members or updating single array elements.
If you only want to get the entire papers array you need to iterate over a Map like this:
Map<String, Object> map = documentSnapshot.getData();
for (Map.Entry<String, Object> entry : map.entrySet()) {
if (entry.getKey().equals("Phonenumbers")) {
Log.d("TAG", entry.getValue().toString());
}
}
But note, even if Phonenumbers object is stored in the database as an array, entry.getValue() returns an ArrayList, not an array.
You need to use indexes only when you query your database using more then one property. But is not your case.
A better approach will be if you consider this alternative database structure, where each phone number is the key in a map and all values are true:
Phonenumbers: {
"987654321": true,
"123456789": true,
"234567890": true
}
Edit 13 Aug 2018:
According to the updated documentation regarding array membership, now it is possible to filter data based on array values using whereArrayContains() method. A simple example would be:
CollectionReference citiesRef = db.collection("cities");
citiesRef.whereArrayContains("regions", "west_coast");
This query returns every city document where the regions field is an array that contains west_coast. If the array has multiple instances of the value you query on, the document is included in the results only once.