/// <summary> /// A query that match on any (configurable) of the provided terms. This is a simpler syntax query for using a bool query with several term queries in the should clauses. /// </summary> public QueryContainer TermsDescriptor <K>(Action <TermsQueryDescriptor <T, K> > selector) { var query = new TermsQueryDescriptor <T, K>(); selector(query); return(this.New(query, q => q.Terms = query)); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var filter = new TermsQueryDescriptor <object, object>(); ITermsQuery f = filter; if (reader.TokenType != JsonToken.StartObject) { return(null); } var depth = reader.Depth; while (reader.Read() && reader.Depth >= depth && reader.Value != null) { var property = reader.Value as string; switch (property) { case "disable_coord": reader.Read(); f.DisableCoord = reader.Value as bool?; break; case "minimum_should_match": reader.Read(); var min = serializer.Deserialize <MinimumShouldMatch>(reader); f.MinimumShouldMatch = min; break; case "boost": reader.Read(); f.Boost = reader.Value as double?; break; case "_name": f.Name = reader.ReadAsString(); break; default: f.Field = property; //reader.Read(); ReadTerms(f, reader, serializer); //reader.Read(); break; } } return(filter); }