Hi all,
I am using ElasticSearch 7.0.1 and Nest 6.6.0. During a multi match query I am getting the next error:
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Int64' because the type requires a JSON primitive value (e.g. string, number, boolean, null) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath 'hits.total.value', line 1, position 193.
I used this query in the version ES 6.2.0 and works fine, but upgrading to 7.0.1 cause that error.
This is my POCO:
public class _doc
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("short_name")]
public string ShortName { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("doc_id")]
public string DocId { get; set; }
}
public static class QueryDescriptor{
public static ISearchRequest() {
searchDescriptor
.Scroll(new Time(1000))
.Size(1000)
.Index(indexName)
.Query(q => q
.MultiMatch(m => m
.Fields(f => f
.Field(f1 => f1.Name)
.Field(f2 => f2.ShortName))
.Query(fieldToMatch)
.MinimumShouldMatch(_minimumShouldMatch)
)
.Sort(s => s.Descending(SortSpecialField.Score)) ;
}
}