Note:
If you do not specify the type of index in cache.xml, the type defaults to “range”.

Listing Indexes

To retrieve a list of indexes from the cache or region, use the QueryService.getIndexes method or the gfsh command line interface.

Using gfsh:

gfsh> list indexes
gfsh> list indexes --with-stats

Using Java API:

QueryService qs = cache.getQueryService();
qs.getIndexes(); //returns a collection of all indexes in the cache
qs.getIndexes(exampleRegion); //returns a collection of all indexes in exampleRegion
qs.getIndexes(exampleRegion, myKeyIndex); //returns the index named myKeyIndex from the exampleRegion

Removing Indexes

To remove an index or all indexes from the cache or region, use the QueryService.removeIndexes method or the gfsh command line interface.

QueryService qs = cache.getQueryService();
qs.removeIndexes(); //removes all indexes from the cache
qs.removeIndexes(myKeyIndex); //removes the index named myKeyIndex
qs.removeIndexes(exampleRegion); //removes all indexes from the exampleRegion