The phrase query allows to query for exact term phrases in the index. The provided terms must exist in the correct order, at the correct index offsets, in the specified field (as no analyzer are applied to the terms). Queried field must have been indexed with includeTermVectors set to true. It is generally more useful in debugging scenarios, and the Match Phrase Query should usually be preferred for real-world use cases.
Inheritance: FtsQueryBase
        public void Export_With_SearchParams_ReturnsValidJson()
        {
            var query = new PhraseQuery("foo").Field("bar");
            var searchParams = new SearchParams();
            var result = query.Export(searchParams).ToString(Formatting.None);

            var expected = JsonConvert.SerializeObject(new
            {
                ctl = new
                {
                    timeout = 75000
                },
                query = new
                {
                    boost = 0.0,
                    field = "bar",
                    terms = new[]
                    {
                        "foo"
                    }
                }
            }, Formatting.None);

            Assert.AreEqual(expected, result);
        }
        public void Export_Omits_Field_If_Not_Provided()
        {
            var query = new PhraseQuery("foo");

            var expected = JsonConvert.SerializeObject(new
            {
                terms = new[] {"foo"}
            }, Formatting.None);

            Assert.AreEqual(expected, query.Export().ToString(Formatting.None));
        }
        public void Export_ReturnsValidJson()
        {
            var query = new PhraseQuery("foo").Field("bar");

            var expected = JsonConvert.SerializeObject(new
            {
                terms = new[] {"foo"},
                field = "bar",
            }, Formatting.None);

            Assert.AreEqual(expected, query.Export().ToString(Formatting.None));
        }