public void Index(MetadataElastic metadataElastic) { var response = Client.Index(metadataElastic); ResponseValidator(response); Client.Flush(IndexName); }
public void Index(string id, MetadataElastic metadataElastic) { var response = Client.Index(metadataElastic, desc => desc.Id(id)); ResponseValidator(response); Client.Flush(IndexName); }
public void CreateIndex() { if (indexQuery.IsExists(Constants.SlambyMetadataIndex)) { return; } var client = elasticClientFactory.GetClient(); var descriptor = new CreateIndexDescriptor(Constants.SlambyMetadataIndex); descriptor .Settings(s => s .NumberOfReplicas(0) .NumberOfShards(1)) .Mappings(m => m .Map <MetadataElastic>(mm => mm .AutoMap() .Dynamic(false) )); var createResp = client.CreateIndex(descriptor); ResponseValidator(createResp); var metadataElastic = new MetadataElastic() { DBVersion = 0 }; Index(metadataElastic); }