本文整理汇总了C#中ElasticsearchContext.IndexCreate方法的典型用法代码示例。如果您正苦于以下问题:C# ElasticsearchContext.IndexCreate方法的具体用法?C# ElasticsearchContext.IndexCreate怎么用?C# ElasticsearchContext.IndexCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElasticsearchContext
的用法示例。
在下文中一共展示了ElasticsearchContext.IndexCreate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGeoShapeCircleMapping
public void CreateGeoShapeCircleMapping()
{
var geoShapeCircleDto = new GeoShapeCircleDto
{
CircleTest = new GeoShapeCircle
{
Coordinates = new GeoPoint(45, 45),
Radius="100m"
},
Id = "1",
Name = "test",
};
using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver)))
{
context.TraceProvider = new ConsoleTraceProvider();
context.IndexCreate<GeoShapeCircleDto>();
Thread.Sleep(1500);
Assert.IsNotNull(context.IndexExists<GeoShapeCircleDto>());
context.AddUpdateDocument(geoShapeCircleDto, geoShapeCircleDto.Id);
context.SaveChanges();
Thread.Sleep(1500);
Assert.AreEqual(1, context.Count<GeoShapeCircleDto>());
var result = context.SearchById<GeoShapeCircleDto>(1);
Assert.AreEqual(geoShapeCircleDto.CircleTest.Coordinates.Count, result.CircleTest.Coordinates.Count);
}
}
示例2: CreateNewIndexAndMappingWithSimpleNullListAndNullArrayList
public void CreateNewIndexAndMappingWithSimpleNullListAndNullArrayList()
{
using ( var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver)))
{
context.TraceProvider = new ConsoleTraceProvider();
context.IndexCreate<MappingTestsParent>();
Thread.Sleep(1500);
var result = context.IndexExists<MappingTestsParent>();
Assert.IsTrue(result);
}
}
示例3: Setup
public void Setup()
{
var doc1 = new SearchTest
{
Id = 1,
Details = "This is the details of the document, very interesting",
Name = "one",
CircleTest = new GeoShapeCircle { Radius = "100m", Coordinates = new GeoPoint(45, 45) },
Location = new GeoPoint(45, 45),
Lift = 2.9,
DateOfDetails = DateTime.UtcNow.AddDays(-20)
};
var doc2 = new SearchTest
{
Id = 2,
Details = "Details of the document two, leave it alone",
Name = "two",
CircleTest = new GeoShapeCircle { Radius = "50m", Coordinates = new GeoPoint(46, 45) },
Location = new GeoPoint(46, 45),
Lift = 2.5,
DateOfDetails = DateTime.UtcNow.AddDays(-209)
};
var doc3 = new SearchTest
{
Id = 3,
Details = "This data is different",
Name = "three",
CircleTest = new GeoShapeCircle { Radius = "80m", Coordinates = new GeoPoint(37, 42) },
Location = new GeoPoint(37, 42),
Lift = 2.1,
DateOfDetails = DateTime.UtcNow.AddDays(-34)
};
using (var context = new ElasticsearchContext(ConnectionString, ElasticsearchMappingResolver))
{
context.IndexCreate<SearchTest>();
Thread.Sleep(1200);
context.AddUpdateDocument(doc1, doc1.Id);
context.AddUpdateDocument(doc2, doc2.Id);
context.AddUpdateDocument(doc3, doc3.Id);
context.SaveChanges();
Thread.Sleep(1200);
}
}
示例4: SearchAggNestedBucketAggregationWithNoHits
public void SearchAggNestedBucketAggregationWithNoHits()
{
var testSkillParentObject = new NestedCollectionTest
{
CreatedSkillParent = DateTime.UtcNow,
UpdatedSkillParent = DateTime.UtcNow,
DescriptionSkillParent = "A test entity description",
Id = 8,
NameSkillParent = "cool",
SkillChildren = new Collection<SkillChild> { _entitiesForSkillChild[0], _entitiesForSkillChild[1], _entitiesForSkillChild[2] }
};
using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
{
context.IndexCreate<NestedCollectionTest>();
Thread.Sleep(1200);
context.AddUpdateDocument(testSkillParentObject, testSkillParentObject.Id);
var ret = context.SaveChanges();
Assert.AreEqual(ret.Status, HttpStatusCode.OK);
}
Thread.Sleep(1200);
var search = new Search
{
Aggs = new List<IAggs>
{
new NestedBucketAggregation("nestedagg", "skillchildren")
}
};
using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
{
Assert.IsTrue(context.IndexTypeExists<NestedCollectionTest>());
var items = context.Search<NestedCollectionTest>(search, new SearchUrlParameters { SeachType = SeachType.count });
var aggResult = items.PayloadResult.Aggregations.GetComplexValue<NestedBucketAggregationsResult>("nestedagg");
Assert.AreEqual(3, aggResult.DocCount);
}
}
开发者ID:jnus,项目名称:ElasticsearchCRUD,代码行数:39,代码来源:NestedArraysTestsWithFiltersAndQueriesAndAggregations.cs
示例5: SearchFilterNestedQueryInnerHits
public void SearchFilterNestedQueryInnerHits()
{
var testSkillParentObject = new NestedCollectionTest
{
CreatedSkillParent = DateTime.UtcNow,
UpdatedSkillParent = DateTime.UtcNow,
DescriptionSkillParent = "A test entity description",
Id = 8,
NameSkillParent = "cool",
SkillChildren = new Collection<SkillChild> { _entitiesForSkillChild[0], _entitiesForSkillChild[1], _entitiesForSkillChild[2] }
};
using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
{
context.IndexCreate<NestedCollectionTest>();
Thread.Sleep(1200);
context.AddUpdateDocument(testSkillParentObject, testSkillParentObject.Id);
var ret = context.SaveChanges();
Assert.AreEqual(ret.Status, HttpStatusCode.OK);
}
Thread.Sleep(1200);
var search = new Search
{
Query =
new Query(
new NestedQuery(
new MatchAllQuery(), "skillchildren")
{
InnerHits = new InnerHits()
})
};
using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
{
Assert.IsTrue(context.IndexTypeExists<NestedCollectionTest>());
var items = context.Search<NestedCollectionTest>(search);
Assert.AreEqual(8, items.PayloadResult.Hits.HitsResult[0].Source.Id);
}
}
开发者ID:jnus,项目名称:ElasticsearchCRUD,代码行数:40,代码来源:NestedArraysTestsWithFiltersAndQueriesAndAggregations.cs
示例6: SearchAggNestedBucketAggregationWithSubReverseNestedWithNoHits
public void SearchAggNestedBucketAggregationWithSubReverseNestedWithNoHits()
{
var testSkillParentObject = new NestedCollectionTest
{
CreatedSkillParent = DateTime.UtcNow,
UpdatedSkillParent = DateTime.UtcNow,
DescriptionSkillParent = "A test entity description",
Id = 8,
NameSkillParent = "cool",
SkillChildren = new Collection<SkillChild> { _entitiesForSkillChild[0], _entitiesForSkillChild[1], _entitiesForSkillChild[2] }
};
using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
{
context.IndexCreate<NestedCollectionTest>();
Thread.Sleep(1200);
context.AddUpdateDocument(testSkillParentObject, testSkillParentObject.Id);
var ret = context.SaveChanges();
Assert.AreEqual(ret.Status, HttpStatusCode.OK);
}
Thread.Sleep(1200);
var search = new Search
{
Aggs = new List<IAggs>
{
new NestedBucketAggregation("nestedagg", "skillchildren")
{
Aggs = new List<IAggs>
{
new MaxMetricAggregation("test", "skillchildren.updatedskillchild"),
new ReverseNestedBucketAggregation("goingUp")
{
Aggs = new List<IAggs>
{
new TermsBucketAggregation("termParent", "descriptionskillparent")
}
}
}
}
}
};
using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
{
Assert.IsTrue(context.IndexTypeExists<NestedCollectionTest>());
var items = context.Search<NestedCollectionTest>(search, new SearchUrlParameters { SeachType = SeachType.count });
var aggResult = items.PayloadResult.Aggregations.GetComplexValue<NestedBucketAggregationsResult>("nestedagg");
var max = aggResult.GetSingleMetricSubAggregationValue<long>("test");
var nesteTestResult = aggResult.GetSubAggregationsFromJTokenName<ReverseNestedBucketAggregationsResult>("goingUp");
var termParentAgg = nesteTestResult.GetSubAggregationsFromJTokenName<TermsBucketAggregationsResult>("termParent");
Assert.AreEqual(3, aggResult.DocCount);
Assert.Greater(max, 1423210851080);
Assert.AreEqual(1, nesteTestResult.DocCount);
Assert.AreEqual("a", termParentAgg.Buckets[0].Key);
}
}
开发者ID:jnus,项目名称:ElasticsearchCRUD,代码行数:59,代码来源:NestedArraysTestsWithFiltersAndQueriesAndAggregations.cs
示例7: AddSearchHightlightResultDataFastestAnimalPostings
private void AddSearchHightlightResultDataFastestAnimalPostings()
{
using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
{
context.IndexCreate<FastestAnimalPostings>();
Thread.Sleep(1200);
var animals = new List<FastestAnimalPostings>
{
new FastestAnimalPostings {Id = 1, AnimalName = "Cheetah", Speed = "112–120 km/h (70–75 mph)", SpeedMph="70–75 mph", SpeedKmh="112–120 km/h", Data = "The Cheetah can accelerate from 0 to 96.6 km/h (60.0 mph) in under three seconds, though endurance is limited: most Cheetahs run for only 60 seconds at a time. When sprinting, cheetahs spend more time in the air than on the ground."},
new FastestAnimalPostings {Id = 2, AnimalName = "Free-tailed bat", Speed = "96.6 km/h (60.0 mph)", SpeedMph="60.0 mph", SpeedKmh="96.6 km/h",Data = "Some attribute such flying capabilities specifically to the Mexican free-tailed bat. Tail wind is what allows free-tailed bats to reach such high speeds."},
new FastestAnimalPostings {Id = 3, AnimalName = "Pronghorn", Speed = "96.6 km/h (60.0 mph)", SpeedMph="60.0 mph", SpeedKmh="96.6 km/h",Data = "The pronghorn (American antelope) is the fastest animal over long distances; it can run 56 km/h for 6 km (35 mph for 4 mi), 67 km/h for 1.6 km (42 mph for 1 mi), and 88.5 km/h for .8 km (55 mph for .5 mi)."},
new FastestAnimalPostings {Id = 4, AnimalName = "Springbok", Speed = "88 km/h (55 mph)", SpeedMph="55 mph", SpeedKmh="88 km/h",Data = "The springbok, an antelope of the gazelle tribe in southern Africa, can make long jumps and sharp turns while running. Unlike pronghorns, springboks are poor long-distance runners."},
new FastestAnimalPostings {Id = 5, AnimalName = "Wildebeest", Speed = "80.5 km/h (50.0 mph)", SpeedMph="50.0 mph", SpeedKmh="80.5 km/h",Data = "The wildebeest, an antelope, exists as two species: the blue wildebeest and the black wildebeest. Both are extremely fast runners, which allows them to flee from predators. They are better at endurance running than at sprinting."},
new FastestAnimalPostings {Id = 6, AnimalName = "Blackbuck", Speed = "80 km/h (50 mph)", SpeedMph="50 mph", SpeedKmh="80 km/h",Data = "The blackbuck antelope can sustain speeds of 80 km/h (50 mph) for over 1.5 km (0.93 mi) at a time. Each of its strides (i.e., the distance between its hoofprints) is 5.8–6.7 m (19–22 ft)."},
new FastestAnimalPostings {Id = 7, AnimalName = "Lion", Speed = "80 km/h (50 mph)", SpeedMph="50 mph", SpeedKmh="80 km/h",Data = "Lionesses are faster than males and can reach maximum speeds of 35 mph (57 km/h) in short distances of approximately 90 meters, and a top speed of 50 mph (80 km/h) for about 20 meters. Lions are very agile and have fast reflexes. Like other predators, they hunt sick prey. Their rate of success in hunting is greatest at night. Lions hunt buffalos, giraffes, warthogs, wildebeests and zebras, and sometimes various antelopes as opportunities present themselves."},
new FastestAnimalPostings {Id = 8, AnimalName = "Greyhound", Speed = "74 km/h (46 mph)", SpeedMph="46 mph", SpeedKmh="74 km/h",Data = "Greyhounds are the fastest dogs, and have primarily been bred for coursing game and racing."},
new FastestAnimalPostings {Id = 9, AnimalName = "Jackrabbit", Speed = "72 km/h (45 mph)", SpeedMph="45 mph", SpeedKmh="72 km/h",Data = "The jackrabbit's strong hind legs allow it to leap 3 m (9.8 ft) in one bound; some can even reach 6 m (20 ft). Jackrabbits use a combination of leaps and zig-zags to outrun predators."},
new FastestAnimalPostings {Id = 10, AnimalName = "African wild dog", Speed = "71 km/h (44 mph)", SpeedMph="44 mph", SpeedKmh="71 km/h",Data = "When hunting, African wild dogs can sprint at 66 km/h (41 mph) in bursts, and they can maintain speeds of 56–60 km/h (35–37 mph) for up to 4.8 km (3 mi). Their targeted prey rarely escapes."},
new FastestAnimalPostings {Id = 11, AnimalName = "Kangaroo", Speed = "71 km/h (44 mph)", SpeedMph="44 mph", SpeedKmh="71 km/h",Data = "The comfortable hopping speed for a kangaroo is about 21–26 km/h (13–16 mph), but speeds of up to 71 km/h (44 mph) can be attained over short distances, while it can sustain a speed of 40 km/h (25 mph) for nearly 2 km (1.2 mi). The faster a kangaroo hops, the less energy it consumes (up to its cruising speed)."},
new FastestAnimalPostings {Id = 12, AnimalName = "Horse", Speed = "70.76 km/h (43.97 mph)", SpeedMph="43.97 mph", SpeedKmh="70.76 km/h",Data = "The fastest horse speed was achieved by a Quarter horse. It reached 70.76 km/h (43.97 mph)."},
new FastestAnimalPostings {Id = 13, AnimalName = "Onager", Speed = "70 km/h (43 mph)", SpeedMph="43 mph", SpeedKmh="70 km/h",Data = "The onager consists of several subspecies, which most likely share the same ability to run at high speeds."},
new FastestAnimalPostings {Id = 14, AnimalName = "Thomson's gazelle", Speed = "70 km/h (43 mph)", SpeedMph="43 mph", SpeedKmh="70 km/h",Data = "Thomson's gazelles, being long-distance runners, can escape cheetahs by sheer endurance. Their speed is partially due to their \"stotting\", or bounding leaps."},
};
foreach (var animal in animals)
{
context.AddUpdateDocument(animal, animal.Id);
}
context.SaveChanges();
}
}
示例8: Setup
public void Setup()
{
var doc1 = new TestObjParentSep
{
Id = 1,
Info = "yes this is great",
ChildObjects = new List<TestObjChildSep>
{
new TestObjChildSep
{
Id=1,
Details="my child"
}
}
};
var doc2 = new TestObjParentSep
{
Id = 2,
Info = "yes this is great two child",
ChildObjects = new List<TestObjChildSep>
{
new TestObjChildSep
{
Id = 1,
Details = "my child"
}
}
};
var doc3 = new TestObjParentSep
{
Id = 3,
Info = "yes this is great three",
ChildObjects = new List<TestObjChildSep>
{
new TestObjChildSep
{
Id = 3,
Details = "my child three"
},
new TestObjChildSep
{
Id = 4,
Details = "my child four"
}
}
};
ElasticsearchMappingResolver.AddElasticSearchMappingForEntityType(typeof(TestObjChildSep),
MappingUtils.GetElasticsearchMapping<TestObjChildSep>("testobjparentseps", "testobjchildsep"));
using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(ElasticsearchMappingResolver,true,true)))
{
context.IndexCreate<TestObjParentSep>();
Thread.Sleep(1200);
context.AddUpdateDocument(doc1, doc1.Id);
context.AddUpdateDocument(doc2, doc2.Id);
context.AddUpdateDocument(doc3, doc3.Id);
context.SaveChanges();
Thread.Sleep(1200);
}
}
开发者ID:jnus,项目名称:ElasticsearchCRUD,代码行数:63,代码来源:SearchQueryQueryTopChildrenAndChidrenBucketAggregationTests.cs
示例9: CreateNewIndexAndMappingForNestedChildInTwoStepsWithRouting
public void CreateNewIndexAndMappingForNestedChildInTwoStepsWithRouting()
{
const string index = "newindextestmappingtwostep";
IElasticsearchMappingResolver elasticsearchMappingResolver;
var mappingTestsParent = SetupIndexMappingTests(index, out elasticsearchMappingResolver);
var routing = new RoutingDefinition {RoutingId = "coolrouting"};
var config = new ElasticsearchSerializerConfiguration(elasticsearchMappingResolver,true,false,true);
using (var context = new ElasticsearchContext(ConnectionString, config))
{
context.AllowDeleteForIndex = true;
context.TraceProvider = new ConsoleTraceProvider();
context.IndexCreate(index);
Thread.Sleep(1500);
Assert.IsTrue(context.IndexExists<MappingTestsParent>());
context.IndexCreateTypeMapping<MappingTestsParent>(new MappingDefinition { Index = index, RoutingDefinition = routing });
Thread.Sleep(1500);
context.AddUpdateDocument(mappingTestsParent, mappingTestsParent.MappingTestsParentId, routing);
context.SaveChanges();
Thread.Sleep(1500);
var doc = context.GetDocument<MappingTestsParent>(mappingTestsParent.MappingTestsParentId, routing);
Thread.Sleep(1500);
Assert.IsNotNull(doc);
context.DeleteIndexType<MappingTestsParent>();
Thread.Sleep(1500);
Assert.IsFalse(context.IndexTypeExists<MappingTestsParent>());
if (context.IndexExists<MappingTestsParent>())
{
context.DeleteIndex<MappingTestsParent>();
}
}
}
示例10: CreateNewIndexAndMappingWithSourceDisabled
public void CreateNewIndexAndMappingWithSourceDisabled()
{
var indexDefinition = new IndexDefinition {IndexSettings = {NumberOfShards = 3, NumberOfReplicas = 1}};
indexDefinition.Mapping.Source.Enabled = false;
var mappingTypeAll = new MappingTypeSourceTest
{
Id = 1,
DescStoreFalse = "non",
DescStoreTrue = "yes",
DescThreeNoDef = "three"
};
using (
var context = new ElasticsearchContext(ConnectionString,
new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver)))
{
context.TraceProvider = new ConsoleTraceProvider();
context.IndexCreate<MappingTypeSourceTest>(indexDefinition);
context.AddUpdateDocument(mappingTypeAll, mappingTypeAll.Id);
context.SaveChanges();
Thread.Sleep(1500);
var doc = context.Search<MappingTypeSourceTest>(BuildSearchById(1));
Assert.GreaterOrEqual(doc.PayloadResult.Hits.HitsResult.First().Id.ToString(), "1");
Assert.IsNull(doc.PayloadResult.Hits.HitsResult.First().Source);
}
}
示例11: AddAllData
public void AddAllData()
{
var elasticsearchContext = new ElasticsearchContext("http://localhost:9200/", new ElasticsearchMappingResolver());
elasticsearchContext.IndexCreate<SnakeBites>();
Thread.Sleep(2000);
List<SnakeBites> data = JsonConvert.DeserializeObject<List<SnakeBites>>(File.ReadAllText(_optionsApplicationConfiguration.Value.FilePath));
long counter = 1;
foreach (var snakeCountry in data)
{
// create some documents
counter++;
elasticsearchContext.AddUpdateDocument(snakeCountry, counter);
}
elasticsearchContext.SaveChanges();
}
示例12: CreateNewIndexAndMappingWithSimpleNullListAndNullArrayListAndAliasAndWarmer
public void CreateNewIndexAndMappingWithSimpleNullListAndNullArrayListAndAliasAndWarmer()
{
using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver)))
{
context.TraceProvider = new ConsoleTraceProvider();
context.IndexCreate<AliasCreateIndexOne>(
new IndexDefinition
{
IndexAliases = new IndexAliases
{
Aliases = new List<IndexAlias>
{
new IndexAlias("testnew"), new IndexAlias("testnewroute")
{
Routing = "ddd"
}
}
},
IndexWarmers = new IndexWarmers
{
Warmers = new List<IndexWarmer>
{
new IndexWarmer("warmer_one")
{
Query= new Query(new MatchAllQuery()),
Aggs = new List<IAggs>
{
new SumMetricAggregation("sum", "id")
}
}
}
}
});
Thread.Sleep(1500);
var result = context.IndexExists<AliasCreateIndexOne>();
Assert.IsTrue(result);
}
}
示例13: Setup
public void Setup()
{
_elasticsearchMappingResolver.AddElasticSearchMappingForEntityType(typeof(object), new GlobalElasticsearchMapping());
using (var context = new ElasticsearchContext(ConnectionString, _elasticsearchMappingResolver))
{
var doc1 = new IndexOne
{
Id = 1,
RandomNumber = 49.3
};
var doc2 = new IndexOne
{
Id = 2,
RandomNumber = 49.3
};
var doc3 = new IndexTwo
{
Id = 1,
Description = "nice day"
};
context.IndexCreate<IndexOne>();
context.IndexCreate<IndexTwo>();
Thread.Sleep(1200);
context.AddUpdateDocument(doc1, doc1.Id);
context.AddUpdateDocument(doc2, doc2.Id);
context.AddUpdateDocument(doc3, doc3.Id);
context.SaveChanges();
Thread.Sleep(1200);
}
}
示例14: CreateGeoShapePolygonMapping
public void CreateGeoShapePolygonMapping()
{
var geoShapePolygonDto = new GeoShapePolygonDto
{
Coordinates = new GeoShapePolygon
{
Coordinates = new List<List<GeoPoint>>
{
// [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]
new List<GeoPoint>
{
new GeoPoint(100, 0),
new GeoPoint(101, 0),
new GeoPoint(101, 1),
new GeoPoint(100, 1),
new GeoPoint(100, 0)
},
// [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ]
new List<GeoPoint>
{
new GeoPoint(100.2, 0.2),
new GeoPoint(100.8, 0.2),
new GeoPoint(100.8, 0.8),
new GeoPoint(100.2, 0.8),
new GeoPoint(100.2, 0.2)
}
}
},
Id = "1",
Name = "test",
};
using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver)))
{
context.TraceProvider = new ConsoleTraceProvider();
context.IndexCreate<GeoShapePolygonDto>();
Thread.Sleep(1500);
Assert.IsNotNull(context.IndexExists<GeoShapePolygonDto>());
context.AddUpdateDocument(geoShapePolygonDto, geoShapePolygonDto.Id);
context.SaveChanges();
Thread.Sleep(1500);
Assert.AreEqual(1,context.Count<GeoShapePolygonDto>());
var result = context.SearchById<GeoShapePolygonDto>(1);
Assert.AreEqual(geoShapePolygonDto.Coordinates.Coordinates.Count, result.Coordinates.Coordinates.Count);
}
}
示例15: UpdateIndexSettingsGlobal
public void UpdateIndexSettingsGlobal()
{
using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchMappingResolver()))
{
if (!context.IndexExists<MappingTestsParent>())
{
context.IndexCreate<MappingTestsParent>();
}
context.TraceProvider = new ConsoleTraceProvider();
var result = context.IndexUpdateSettings(new IndexUpdateSettings { NumberOfReplicas = 1 });
context.AllowDeleteForIndex = true;
context.DeleteIndex<MappingTestsParent>();
Assert.AreEqual("completed", result.PayloadResult);
}
}