code: private void rebuildIndexOneEntity(String entityTypeId, String untypedEntityId) {
      LOG.trace("Indexing [{}].[{}]... ", entityTypeId, untypedEntityId);
  
      // convert entity id string to typed entity id
      EntityType entityType = dataService.getEntityType(entityTypeId);
      if (null != entityType) {
        Object entityId = getTypedValue(untypedEntityId, entityType.getIdAttribute());
        String entityFullName = entityType.getId();
  
        Entity actualEntity = dataService.findOneById(entityFullName, entityId);
  
        if (null == actualEntity) {
          // Delete
          LOG.debug("Index delete [{}].[{}].", entityFullName, entityId);
          indexService.deleteById(entityType, entityId);
          return;
        }
  
        boolean indexEntityExists = indexService.hasIndex(entityType);
        if (!indexEntityExists) {
          LOG.debug("Create mapping of repository [{}] because it was not exist yet", entityTypeId);
          indexService.createIndex(entityType);
        }
  
        LOG.debug("Index [{}].[{}].", entityTypeId, entityId);
        indexService.index(actualEntity.getEntityType(), actualEntity);
      } else {
        throw new MolgenisDataException("Unknown EntityType for entityTypeId: " + entityTypeId);
      }
    }
docs: Indexes one single entity instance.
  
  @param entityTypeId the id of the entity's repository
  @param untypedEntityId the identifier of the entity to update