GetIndexesRequest.Builder builder = GetIndexesRequest.newBuilder()
.setIndexNamePrefix(indexName)
.setSchemaFetched(true);
GetResponse<Index> response = searchService.getIndexes(builder);
for (Index index : response) {
Schema schema = index.getSchema();
for (int i = 0; i < fields.length; i++) {
List<Field.FieldType> typesForField = schema.getFieldTypes(fields[i]);
assertEquals(1, typesForField.size());
assertEquals(fieldTypes[i], typesForField.get(0));
}
List<Field.FieldType> typesForField = schema.getFieldTypes("mixfield");
assertEquals(2, typesForField.size());
for (Field.FieldType fieldType : typesForField) {
assertTrue((fieldType == Field.FieldType.TEXT) ||
(fieldType == Field.FieldType.NUMBER));
}