Example #1
0
        public ReindexApiTests(ReindexCluster cluster, EndpointUsage usage)
        {
            this._client = cluster.Client();
            var indexResult = this._client.IndexMany(Developer.Developers);

            this._client.Refresh(Index <Developer>());
            this._reindexResult = this._client.Reindex <ILazyDocument>(Index <Developer>(), "dev-copy", r => r);
        }
Example #2
0
        public ReindexApiTests(ReindexCluster cluster, EndpointUsage usage)
        {
            this._client = cluster.Client();

            // create a couple of projects
            var projects = Project.Generator.Generate(2).ToList();
            var indexProjectsResponse = this._client.IndexMany(projects, IndexName);

            this._client.Refresh(IndexName);

            // create a thousand commits and associate with the projects
            var commits = CommitActivity.Generator.Generate(1000).ToList();
            var bb      = new BulkDescriptor();

            for (int index = 0; index < commits.Count; index++)
            {
                var commit  = commits[index];
                var project = index % 2 == 0
                                        ? projects[0].Name
                                        : projects[1].Name;

                bb.Index <CommitActivity>(bi => bi
                                          .Document(commit)
                                          .Index(IndexName)
                                          .Id(commit.Id)
                                          .Routing(project)
                                          .Parent(project)
                                          );
            }

            var bulkResult = this._client.Bulk(b => bb);

            bulkResult.IsValid.Should().BeTrue();

            this._client.Refresh(IndexName);

            this._reindexManyTypesResult  = this._client.Reindex <ILazyDocument>(IndexName, NewManyTypesIndexName, r => r.AllTypes());
            this._reindexSingleTypeResult = this._client.Reindex <Project>(IndexName, NewSingleTypeIndexName);
        }