code: protected void addEntityFieldsToDocument(EntityMetadata metadata, Object entity, Document document,
          MetamodelImpl metaModel) {
          String indexName = metadata.getIndexName();
          Map<String, PropertyIndex> indexProperties = metadata.getIndexProperties();
          for (String columnName : indexProperties.keySet()) {
              PropertyIndex index = indexProperties.get(columnName);
              java.lang.reflect.Field property = index.getProperty();
              String propertyName = index.getName();
              addFieldToDocument(entity, document, property, propertyName, indexName);
          }
  
          if (metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) {
              Object id = PropertyAccessorHelper.getId(entity, metadata);
              EmbeddableType embeddableId = metaModel.embeddable(metadata.getIdAttribute().getBindableJavaType());
              Set<Attribute> embeddedAttributes = embeddableId.getAttributes();
              indexCompositeKey(embeddedAttributes, metadata, id, document, metaModel);
          }
      }
docs: Adds the index properties.
  
  @param metadata
  the metadata
  @param entity
  the object
  @param document
  the document
  @param metaModel