Beispiel #1
0
        public void DoWork()
        {
            var indicesApi = new IndicesApi("http://localhost:9800");

            var response = indicesApi.DeleteIndex("contact");

            // This method doesn't return any significant data. It just reports any errors.
            if (response.Error?.Message != null)
            {
                Console.WriteLine(response.Error.Message);
            }
        }
Beispiel #2
0
        public void CheckIfExists()
        {
            var indicesApi = new IndicesApi("http://localhost:9800");

            var response = indicesApi.IndexExists("some-index-name");

            if (response.Error?.Message != null)
            {
                Console.WriteLine(response.Error.Message);
            }
            else
            {
                bool exists = response.Data.Exists;
            }
        }
Beispiel #3
0
        public void GetStatus()
        {
            var indicesApi = new IndicesApi("http://localhost:9800");

            var response = indicesApi.GetIndexStatus("country");

            if (response.Error?.Message != null)
            {
                Console.WriteLine(response.Error.Message);
            }
            else
            {
                IndexStatus status = response.Data.IndexStatus;
            }
        }
        public void DoWork()
        {
            var indicesApi = new IndicesApi("http://*****:*****@countryName)")
            {
                QueryName = "agriSearch"
            };

            var response = indicesApi.UpdateIndexPredefinedQuery(updatedQuery, "country");

            // This method doesn't return any significant data. It just reports any errors.
            if (response.Error?.Message != null)
            {
                Console.WriteLine(response.Error.Message);
            }
        }
        public void Work()
        {
            var indicesApi = new IndicesApi("http://localhost:9800");

            var index = new Index("contact")
            {
                Fields = new Field[]
                {
                    new Field("name", FieldType.Text),
                    new Field("age", FieldType.Int)
                }
            };

            var response = indicesApi.CreateIndex(index);

            Debug.Assert(response.Error?.Message == null);
            Debug.Assert(response.Data == true);
        }