@Test
  public void testStatsForRangeIndexAfterRecreate() throws Exception {

    keyIndex2 = (IndexProtocol) qs.createIndex("multiKeyIndex2", IndexType.FUNCTIONAL, "pos.secId",
        SEPARATOR + "portfolio p, p.positions.values pos");

    assertTrue(keyIndex2 instanceof RangeIndex);

    IndexStatistics keyIndex1Stats = keyIndex2.getStatistics();

    // Initial stats test (keys, values & updates)
    assertEquals(4, keyIndex1Stats.getNumberOfKeys());
    assertEquals(200, keyIndex1Stats.getNumberOfValues());
    assertEquals(200, keyIndex1Stats.getNumUpdates());

    for (int i = 0; i < 100; i++) {
      region.put(Integer.toString(i), new Portfolio(i, i));
    }

    String queryStr = "select * from " + SEPARATOR
        + "portfolio p, p.positions.values pos where pos.secId = 'YHOO'";
    Query query = qs.newQuery(queryStr);

    for (int i = 0; i < 50; i++) {
      query.execute();
    }

    assertEquals(4, keyIndex1Stats.getNumberOfKeys());
    assertEquals(200, keyIndex1Stats.getNumberOfValues());
    assertEquals(400, keyIndex1Stats.getNumUpdates());
    assertEquals(50, keyIndex1Stats.getTotalUses());

    region.clear();

    assertEquals(0, keyIndex1Stats.getNumberOfKeys());
    assertEquals(0, keyIndex1Stats.getNumberOfValues());
    assertEquals(800, keyIndex1Stats.getNumUpdates());
    assertEquals(50, keyIndex1Stats.getTotalUses());

    for (int i = 0; i < 100; i++) {
      region.put(Integer.toString(i), new Portfolio(i, i));
    }

    assertEquals(4, keyIndex1Stats.getNumberOfKeys());
    assertEquals(200, keyIndex1Stats.getNumberOfValues());
    assertEquals(1000, keyIndex1Stats.getNumUpdates());

    for (int i = 0; i < 50; i++) {
      query.execute();
    }

    assertEquals(100, keyIndex1Stats.getTotalUses());

    qs.removeIndex(keyIndex2);
  }
Test RenageIndex IndexStatistics for keys, values, updates and uses.
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/IndexStatisticsJUnitTest.java