コード例 #1
0
        public void CreateMatchQueryTest()
        {
            var queryContainer = Elastic.MakeMatchQuery("query-test", "field-test", fuzziness: 1);
            var queryString    = elastic.Client.RequestResponseSerializer.SerializeToString(queryContainer);
            var realQuery      = "{\"match\":{\"field-test\":{\"fuzziness\":1,\"query\":\"query-test\"}}}";

            Assert.Equal(realQuery, queryString);
        }
コード例 #2
0
        public void BulkTest()
        {
            var documents = new List <Document> {
                new Document("1", "one"), new Document("2", "two"), new Document("3", "three")
            };

            elastic.BulkIndex <Document>(documents, "DocumentId");
            elastic.Refresh();
            var response = elastic.GetResponseOfQuery <Document>(Elastic.MakeMatchQuery("one", "content"));

            Assert.Equal("one", response.Hits.ToList().Single().Source.Content);
        }