code: @Override
      protected void onPersist(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders)
      {
          try
          {
              Map<String, Object> values = new HashMap<String, Object>();
  
              MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
                      .getMetamodel(entityMetadata.getPersistenceUnit());
  
              EntityType entityType = metaModel.entity(entityMetadata.getEntityClazz());
  
              String keyAsString = getKeyAsString(id, entityMetadata, metaModel);
  
              addSource(entity, values, entityType);
  
              addRelations(rlHolders, values);
              addDiscriminator(values, entityType);
  
              IndexResponse response = txClient
                      .prepareIndex(entityMetadata.getSchema().toLowerCase(), entityMetadata.getTableName(), keyAsString)
                      .setSource(values).setRefresh(isRefreshIndexes()).execute().actionGet();
  
              assert response.getId() != null;
          }
          finally
          {
              // Nothing as of now.
          }
  
      }
docs: /*
  (non-Javadoc)
  
  @see com.impetus.kundera.client.ClientBase#onPersist(com.impetus.kundera.
  metadata .model.EntityMetadata, java.lang.Object, java.lang.Object,
  java.util.List)