1、异步执行var entity = new Company {Name = "Async Company #2", Id = "companies/2"};using (var session = documentStore.OpenAsyncSession()){ var company = await session.LoadAsync(1); // loading an entity asynchronously await session.StoreAsync(entity); // in-memory operations are committed asynchronously when calling SaveChangesAsync await session.SaveChangesAsync(); // returns a task that completes asynchronously var query = session.Query () .Where(x => x.Name == "Async Company #1") .ToListAsync(); // returns a task that will execute the query}2、维度查询假设我们有一个这样的文档: { DateOfListing: "2000-09-01T00:00:00.0000000+01:00" Manufacturer: "Jessops" Model: "blah" Cost: 717.502206059872 Zoom: 9 Megapixels: 10.4508949012733 ImageStabiliser: false}1)建立基于制造厂商,成本和像素的维度var _facets = new List { new Facet { Name = "Manufacturer" }, new Facet { Name = "Cost_Range", Mode = FacetMode.Ranges, Ranges = { "[NULL TO Dx200.0]", "[Dx200.0 TO Dx400.0]", "[Dx400.0 TO Dx600.0]", "[Dx600.0 TO Dx800.0]", "[Dx800.0 TO NULL]", } }, new Facet { Name = "Megapixels_Range", Mode = FacetMode.Ranges, Ranges = { "[NULL TO Dx3.0]", "[Dx3.0 TO Dx7.0]", "[Dx7.0 TO Dx10.0]", "[Dx10.0 TO NULL]", } } };成本字段范围Cost <= 200.0200.0 <= Cost <= 400.0400.0 <= Cost <= 600.0600.0 <= Cost <= 800.0Cost >= 800.0像素字段范围Megapixels <= 3.03.0 <= Megapixels <= 7.07.0 <= Megapixels <= 10.0Megapixels >= 10.0//保存session.Store(new FacetSetup { Id = "facets/CameraFacets", Facets = _facets });2、创建索引store.DatabaseCommands.PutIndex("CameraCost", new IndexDefinition { Map = @"from camera in docs select new { camera.Manufacturer, camera.Model, camera.Cost, camera.DateOfListing, camera.Megapixels }" });3、查询var facetResults = session.Query ("CameraCost") .Where(x => x.Cost >= 100 && x.Cost <= 300) .ToFacets("facets/CameraFacets");通过通过这个网址查询:http://localhost:8080/facets/CameraCost?facetDoc=facets/CameraFacets&query=Cost_Range:[Dx100 TO Dx300.0]结果如下: { Manufacturer: [ { Range: 'canon', Count: 42 }, { Range: 'jessops', Count: 50 }, { Range: 'nikon', Count: 46 }, { Range: 'phillips', Count: 44 }, { Range: 'sony', Count: 35 } ], Cost_Range: [ { Range: '[NULL TO Dx200.0]', Count: 115 }, { Range: '[Dx200.0 TO Dx400.0]', Count: 102 } ], Megapixels_Range: [ { Range: '[NULL TO Dx3.0]', Count: 42 }, { Range: '[Dx3.0 TO Dx7.0]', Count: 79 }, { Range: '[Dx7.0 TO Dx10.0]', Count: 82 }, { Range: '[Dx10.0 TO NULL]', Count: 14 } ]}