Пример #1
0
        private static List <Func <object> > IndexCommandsAsync(ElasticClient elastic)
        {
            return(new List <Func <object> >
            {
                () => elastic.CreateIndexAsync("test_index_1"),
                () => elastic.IndexExistsAsync("test_index_1"),
                () => elastic.UpdateIndexSettingsAsync(new UpdateIndexSettingsRequest("test_index_1")
                {
                    IndexSettings = new IndexSettings()
                    {
                        Sorting = new SortingSettings
                        {
                            Fields = new Field("Title"),
                        },
                    },
                }),
                () => elastic.AliasAsync(new BulkAliasRequest
                {
                    Actions = new List <IAliasAction>
                    {
                        new AliasAddAction
                        {
                            Add = new AliasAddOperation
                            {
                                Index = "test_index_1",
                                Alias = "test_index_2",
                            },
                        },
                    },
                }),
                () => elastic.GetAliasesPointingToIndexAsync("test_index_1"),
                () => elastic.PutAliasAsync("test_index_1", "test_index_3"),
                () => elastic.AliasExistsAsync(new AliasExistsRequest("test_index_1")),
                () => elastic.DeleteAliasAsync(new DeleteAliasRequest("test_index_1", "test_index_3")),
                () => elastic.DeleteAliasAsync(new DeleteAliasRequest("test_index_1", "test_index_2")),
                () => elastic.CreateIndexAsync("test_index_4"),
#if (ELASTICSEARCH_6_1 && !DEFAULT_SAMPLES)
                () => elastic.SplitIndexAsync("test_index_1", "test_index_4"),
#endif
                () => elastic.DeleteIndexAsync("test_index_4"),
                () => elastic.CloseIndexAsync("test_index_1"),
                () => elastic.OpenIndexAsync("test_index_1"),
                () => elastic.PutIndexTemplateAsync(new PutIndexTemplateRequest("test_template_1")),
                () => elastic.IndexTemplateExistsAsync("test_template_1"),
                () => elastic.DeleteIndexTemplateAsync("test_template_1"),
                () => elastic.IndicesShardStoresAsync(),
                () => elastic.IndicesStatsAsync("test_index_1"),
                () => elastic.DeleteIndexAsync("test_index_1"),
                () => elastic.GetAliasAsync(new GetAliasRequest()),
            });
        }
Пример #2
0
        private static List <Func <object> > IndexCommandsAsync(ElasticClient elastic)
        {
            return(new List <Func <object> >
            {
                () => elastic.CreateIndexAsync("test_index_1"),
                () => elastic.IndexExistsAsync("test_index_1"),
                () => elastic.UpdateIndexSettingsAsync(new UpdateIndexSettingsRequest("test_index_1")
                {
                    IndexSettings = new IndexSettings()
                    {
                        Sorting = new SortingSettings
                        {
                            Fields = new Field("Title"),
                        },
                    },
                }),
                () => elastic.AliasAsync(new BulkAliasRequest
                {
                    Actions = new List <IAliasAction>
                    {
                        new AliasAddAction
                        {
                            Add = new AliasAddOperation
                            {
                                Index = "test_index_1",
                                Alias = "test_index_2",
                            },
                        },
                    },
                }),
                () => elastic.GetAliasesPointingToIndexAsync("test_index_1"),
                () => elastic.PutAliasAsync("test_index_1", "test_index_3"),
                () => elastic.AliasExistsAsync(new AliasExistsRequest("test_index_1")),
                () => elastic.DeleteAliasAsync(new DeleteAliasRequest("test_index_1", "test_index_3")),
                () => elastic.DeleteAliasAsync(new DeleteAliasRequest("test_index_1", "test_index_2")),
                () => elastic.CreateIndexAsync("test_index_4"),
#if (ELASTICSEARCH_6_1 && !DEFAULT_SAMPLES)
                () => elastic.SplitIndexAsync("test_index_1", "test_index_4"),
#endif
                () => elastic.DeleteIndexAsync("test_index_4"),
                () => elastic.CloseIndexAsync("test_index_1"),
                () => elastic.OpenIndexAsync("test_index_1"),
                () => elastic.PutIndexTemplateAsync(new PutIndexTemplateRequest("test_template_1")),
                () => elastic.IndexTemplateExistsAsync("test_template_1"),
                () => elastic.DeleteIndexTemplateAsync("test_template_1"),
                () => elastic.IndicesShardStoresAsync(),
                () => elastic.IndicesStatsAsync("test_index_1"),
                () => elastic.DeleteIndexAsync("test_index_1"),
                () => elastic.GetAliasAsync(new GetAliasRequest()),
                () => elastic.ReindexOnServerAsync(new ReindexOnServerRequest
                {
                    Source = new ReindexSource
                    {
                        Remote = new RemoteSource
                        {
                            Host = new Uri("http://" + Host()),
                            Username = "******",
                            Password = "******"
                        },
                        Index = "some_index",
                        Size = 10
                    },
                    Destination = new ReindexDestination
                    {
                        Index = "some_index_clone",
                    }
                })
            });
        }