private void CreateBulkContentForParentDocument(EntityContextInfo entityInfo, ElasticMapping elasticMapping) { _elasticCrudJsonWriter.JsonWriter.WriteStartObject(); _elasticCrudJsonWriter.JsonWriter.WritePropertyName("index"); // Write the batch "index" operation header _elasticCrudJsonWriter.JsonWriter.WriteStartObject(); WriteValue("_index", elasticMapping.GetIndexForType(entityInfo.EntityType)); WriteValue("_type", elasticMapping.GetDocumentType(entityInfo.EntityType)); WriteValue("_id", entityInfo.Id); if (entityInfo.RoutingDefinition.ParentId != null && _elasticSerializerConfiguration.ProcessChildDocumentsAsSeparateChildIndex) { WriteValue("_parent", entityInfo.RoutingDefinition.ParentId); } if (entityInfo.RoutingDefinition.RoutingId != null && _elasticSerializerConfiguration.UserDefinedRouting) { WriteValue("_routing", entityInfo.RoutingDefinition.RoutingId); } _elasticCrudJsonWriter.JsonWriter.WriteEndObject(); _elasticCrudJsonWriter.JsonWriter.WriteEndObject(); _elasticCrudJsonWriter.JsonWriter.WriteRaw("\n"); //ES requires this \n separator _elasticCrudJsonWriter.JsonWriter.WriteStartObject(); elasticMapping.MapEntityValues(entityInfo, _elasticCrudJsonWriter, true); _elasticCrudJsonWriter.JsonWriter.WriteEndObject(); _elasticCrudJsonWriter.JsonWriter.WriteRaw("\n"); }
private void ProccessPropertyMappingsWithoutTypeName(ElasticJsonWriter elasticCrudJsonWriter, EntityContextInfo entityInfo, ElasticMapping elasticMapping) { //"properties": { elasticCrudJsonWriter.JsonWriter.WritePropertyName("properties"); elasticCrudJsonWriter.JsonWriter.WriteStartObject(); elasticMapping.MapEntityValues(entityInfo, elasticCrudJsonWriter, true, CreatePropertyMappings); elasticCrudJsonWriter.JsonWriter.WriteEndObject(); }