Skip to content

Commit 7bd422d

Browse files
committed
Fix #1027: CommonTermsQuery serializing incorrectly
1 parent f46cedf commit 7bd422d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Nest/DSL/Query/IQueryContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public interface IQueryContainer : ICustomJson
7777
[JsonConverter(typeof(CompositeJsonConverter<GeoShapeQueryJsonReader, FieldNameQueryConverter<EnvelopeGeoShape>>))]
7878
IGeoShapeQuery GeoShape { get; set; }
7979

80-
[JsonProperty(PropertyName = "common_terms")]
80+
[JsonProperty(PropertyName = "common")]
8181
[JsonConverter(typeof (FieldNameQueryConverter<CommonTermsQuery>))]
8282
ICommonTermsQuery CommonTerms { get; set; }
8383

src/Tests/Nest.Tests.Integration/Search/QueryDSLTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,21 @@ public void TestTermFacet()
132132
Assert.Greater(results.FacetItems<TermItem>(f => f.Country).Count(), 0);
133133
}
134134

135+
[Test]
136+
public void TestCommonTerms()
137+
{
138+
var results = this.Client.Search<ElasticsearchProject>(s => s
139+
.Query(q => q
140+
.CommonTerms(t => t
141+
.OnField(p => p.Name)
142+
.Query("elasticsearch")
143+
)
144+
)
145+
);
146+
147+
Assert.True(results.IsValid);
148+
Assert.Greater(results.Hits.Count(), 0);
149+
}
135150

136151
[Test]
137152
public void TermSuggest()

0 commit comments

Comments
 (0)