public void Check_CreateNewIndex_ReturnOk()
        {
            var new_index = "test_new_index";

            if (_elasticSearch.CheckIndecesStatus(new_index))
            {
                _elasticSearch.DeleteIndex(new_index);
            }
            var result = _elasticSearch.CreateNewIndex(new_index);

            Assert.True(result);
        }
示例#2
0
        public ActionResult RunQuery(RunQueryParameters parameters)
        {
            const string indexName = "testindex";

            string opResult = string.Empty;

            opResult = ElasticSearch.DeleteIndex(indexName);
            opResult = ElasticSearch.CreateIndex(indexName);
            opResult = ElasticSearch.CreateMapping(indexName, "test", parameters.Mapping);
            opResult = ElasticSearch.InsertDocument(indexName, "test", parameters.Documents, true);

            Thread.Sleep(2000);

            var response = ElasticSearch.RunSearch(indexName, "test", parameters.Query);

            return(Content(JsonSerialization.Serialize(new {
                queryResult = response
            })));
        }