@Test
  // there is a mismatch of the index name as handled by IndexManagerHolder and the ES-IM: Animal.0
  // vs. Animal00
  @Category(ElasticsearchSupportInProgress.class)
  public void testBehavior() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Animal a = new Animal();
    a.setId(1);
    a.setName("Elephant");
    s.persist(a);
    a = new Animal();
    a.setId(2);
    a.setName("Bear");
    s.persist(a);
    tx.commit();

    s.clear();

    tx = s.beginTransaction();
    a = s.get(Animal.class, 1);
    a.setName("Mouse");
    Furniture fur = new Furniture();
    fur.setColor("dark blue");
    s.persist(fur);
    tx.commit();

    s.clear();

    tx = s.beginTransaction();
    FullTextSession fts = Search.getFullTextSession(s);
    QueryParser parser = new QueryParser("id", TestConstants.stopAnalyzer);

    List results = fts.createFullTextQuery(parser.parse("name:mouse OR name:bear")).list();
    assertEquals(
        "Either double insert, single update, or query fails with shards", 2, results.size());

    results = fts.createFullTextQuery(parser.parse("name:mouse OR name:bear OR color:blue")).list();
    assertEquals("Mixing shared and non sharded properties fails", 3, results.size());
    results = fts.createFullTextQuery(parser.parse("name:mouse OR name:bear OR color:blue")).list();
    assertEquals(
        "Mixing shared and non sharded properties fails with indexreader reuse", 3, results.size());
    for (Object o : results) {
      s.delete(o);
    }
    tx.commit();
    s.close();
  }
  @Test
  // there is a mismatch of the index name as handled by IndexManagerHolder and the ES-IM: Animal.0
  // vs. Animal00
  @Category(ElasticsearchSupportInProgress.class)
  public void testInternalSharding() throws Exception {
    Session s = openSession();
    Transaction tx = s.beginTransaction();
    Animal a = new Animal();
    a.setId(1);
    a.setName("Elephant");
    s.persist(a);
    a = new Animal();
    a.setId(2);
    a.setName("Bear");
    s.persist(a);
    tx.commit();

    s.clear();

    assertEquals(1, getNumberOfDocumentsInIndex("Animal00"));
    assertEquals(1, getNumberOfDocumentsInIndex("Animal.1"));

    tx = s.beginTransaction();
    a = s.get(Animal.class, 1);
    a.setName("Mouse");
    tx.commit();

    s.clear();

    assertEquals(1, getNumberOfDocumentsInIndex("Animal.1"));
    assertEquals(1, getNumberOfDocumentsInIndexByQuery("Animal.1", "name", "mouse"));

    tx = s.beginTransaction();
    FullTextSession fts = Search.getFullTextSession(s);
    QueryParser parser = new QueryParser("id", TestConstants.stopAnalyzer);

    List<?> results = fts.createFullTextQuery(parser.parse("name:mouse OR name:bear")).list();
    assertEquals(
        "Either double insert, single update, or query fails with shards", 2, results.size());
    for (Object o : results) {
      s.delete(o);
    }
    tx.commit();
    s.close();
  }
  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();

    elephant = new Animal();
    elephant.setId(1);
    elephant.setName("Elephant");
    elephant.setType("Mammal");

    spider = new Animal();
    spider.setId(2);
    spider.setName("Spider");
    spider.setType("Insect");

    bear = new Animal();
    bear.setId(3);
    bear.setName("Bear");
    bear.setType("Mammal");
  }