Пример #1
0
        public void Index(MetadataElastic metadataElastic)
        {
            var response = Client.Index(metadataElastic);

            ResponseValidator(response);
            Client.Flush(IndexName);
        }
Пример #2
0
        public void Index(string id, MetadataElastic metadataElastic)
        {
            var response = Client.Index(metadataElastic, desc => desc.Id(id));

            ResponseValidator(response);
            Client.Flush(IndexName);
        }
Пример #3
0
        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);
        }