Example #1
0
        private static async Task TestSingleIndexAsync()
        {
            var data = new
            {
                FirstName = "Camiel",
                LastName  = "Luijkx"
            };

            var response = await ElasticSearchService.IndexAsync("people", "person", "1", data);
        }
Example #2
0
        private static async Task TestBulkIndexAsync()
        {
            var data = new object[]
            {
                new { index = new { _index = "people", _type = "person", _id = "2" } },
                new { FirstName = "Joyce", LastName = "Luijkx" },
                new { index = new { _index = "people", _type = "person", _id = "3" } },
                new { FirstName = "Jimmy", LastName = "Luijkx" },
                new { index = new { _index = "people", _type = "person", _id = "4" } },
                new { FirstName = "Dean", LastName = "Luijkx" },
            };

            var response = await ElasticSearchService.BulkAsync(data);
        }
Example #3
0
        private static async Task TestSearchIndexAsync()
        {
            var data = new
            {
                query = new
                {
                    query_string = new
                    {
                        query = "Luijkx"
                    }
                }
            };

            //var data = @"
            //{
            //  ""query"": {
            //    ""query_string"": {
            //      ""query"": ""Luijkx""
            //    }
            //  }
            //}";

            var response = await ElasticSearchService.SearchAsync("people", "person", data);
        }