public async Task PostScriptTest() { using (Database.DocumentsStorage.ContextPool.AllocateOperationContext(out DocumentsOperationContext context)) { var dbDoc = await context.ReadForMemoryAsync(RequestBodyStream(), "TestElasticSearchEtlScript"); var testScript = JsonDeserializationServer.TestElasticSearchEtlScript(dbDoc); using (ElasticSearchEtl.TestScript(testScript, Database, ServerStore, context, out var result)) { await using (var writer = new AsyncBlittableJsonTextWriter(context, ResponseBodyStream())) { var djv = (DynamicJsonValue)TypeConverter.ToBlittableSupportedType(result); writer.WriteObject(context.ReadObject(djv, "etl/elasticsearch/test")); } } } }
public async Task TestScriptWillHaveDocumentIdPropertiesNotAddedExplicitlyInTheScript() { using (var store = GetDocumentStore()) { using (var session = store.OpenAsyncSession()) { await session.StoreAsync(new Order { Lines = new List <OrderLine> { new OrderLine { PricePerUnit = 3, Product = "Milk", Quantity = 3 }, new OrderLine { PricePerUnit = 4, Product = "Bear", Quantity = 2 }, } }); await session.SaveChangesAsync(); } var result1 = store.Maintenance.Send(new PutConnectionStringOperation <ElasticSearchConnectionString>(new ElasticSearchConnectionString { Name = "simulate", Nodes = new[] { "http://*****:*****@"""OrderId"":""orders/1-a""", orderLines.Commands[1]); var orders = result.Summary.First(x => x.IndexName == OrdersIndexName); Assert.Equal(2, orders.Commands.Length); // delete by query and bulk Assert.Contains(@"""Id"":""orders/1-a""", orders.Commands[1]); } } } }