protected override string ApplyJsonTemplate(string body) { if (RegisteredField.IsNullOrEmpty()) { return("'{0}': {{ {1} }}".AltQuoteF(type.AsString(), body)); } return("'{0}': {{ {1}: {{ {2} }} }}".AltQuoteF(type.AsString(), RegisteredField, body)); }
protected override string ApplyJsonTemplate(string body) { if (RegisteredField.IsNullOrEmpty()) { return("{{ 'more_like_this_field': {{ {0} }} }}".AltQuoteF(body)); } return("{{ 'more_like_this_field': {{ {0}: {{ {1} }} }} }}".AltQuoteF(RegisteredField, body)); }
protected override string ApplyJsonTemplate(string body) { if (RegisteredField.IsNullOrEmpty()) { return("{{ 'text_phrase_prefix': {{ {0} }} }}".AltQuoteF(body)); } return("{{ 'text_phrase_prefix': {{ {0}: {{ {1} }} }} }}".AltQuoteF(RegisteredField, body)); }
protected override string ApplyJsonTemplate(string body) { if (!RegisteredField.IsNullOrEmpty()) { var field = "'field': {0}".AltQuoteF(RegisteredField); if (!body.IsNullOrEmpty()) { body = new[] { field, body } }
/// <summary> /// Controls whether filter will be applied. /// </summary> public ExistsFilter <T> ShouldExists(bool?value) { if (RegisteredField.IsNullOrEmpty()) { return(this); } hasRequiredParts = value.HasValue && value.Value; RegisterJsonPart("'field': {0}", RegisteredField); return(this); }
protected string GetFilterBody(string body) { string criterion = RegisteredField.IsNullOrEmpty() ? body : "{0}: {{ {1} }}".F(RegisteredField, body); modes.Insert(0, criterion); string filterBody = modes.JoinWithComma(); return(filterBody); }
protected override string ApplyJsonTemplate(string body) { if (!RegisteredField.IsNullOrEmpty()) { queryFields.Add(RawFieldName); } if (queryFields.Count > 0) { string fields = JsonHelper.BuildJsonStringsProperty("fields", queryFields); body = new[] { fields, body }.JoinWithComma(); } return("{{ 'multi_match': {{ {0} }} }}".AltQuoteF(body)); }