예제 #1
0
        protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values)
        {
            var enableRemoteClusters = client.ClusterPutSettings(new ClusterPutSettingsRequest
            {
                Transient = new M
                {
                    { "search", new M {
                          { "remote", new M {
                                                    { "cluster_one", new M {
                                                            { "seeds", new[] { "127.0.0.1:9300", "127.0.0.1:9301" } }
                                                        } },
                                                    { "cluster_two", new M {
                                                            { "seeds", new[] { "127.0.0.1:9300" } }
                                                        } }
                                                } }
                      } }
                }
            });

            enableRemoteClusters.ShouldBeValid();

            var remoteSearch = client.Search <Project>(s => s.Index(Index <Project>("cluster_one").And <Project>("cluster_two")));

            remoteSearch.ShouldBeValid();
        }
예제 #2
0
        protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values)
        {
            var oldWay = new M
            {
                {
                    "search", new M
                    {
                        {
                            "remote", new M
                            {
                                {
                                    "cluster_one", new M
                                    {
                                        { "seeds", new[] { "127.0.0.1:9300", "127.0.0.1:9301" } }
                                    }
                                },
                                {
                                    "cluster_two", new M
                                    {
                                        { "seeds", new[] { "127.0.0.1:9300" } }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            /**
             * As of 6.5.0 you can also use the following helper class which uses
             * the new way to configure remote clusters.
             */
            var newWay = new RemoteClusterConfiguration()
            {
                { "cluster_one", "127.0.0.1:9300", "127.0.0.1:9301" },
                { "cluster_two", "127.0.0.1:9300" }
            };
            var enableRemoteClusters = client.ClusterPutSettings(new ClusterPutSettingsRequest
            {
                Transient = oldWay
            });

            enableRemoteClusters.ShouldBeValid();

            var remoteSearch = client.Search <Project>(s => s.Index(Index <Project>("cluster_one").And <Project>("cluster_two")));

            remoteSearch.ShouldBeValid();
        }