NEST thores UnexpectedElasticsearchClient exception on search (NEST 5.3)

I've recently updated my application from Elasticsearch 2.3.1 to 5.3, same for Nest. After going through a process of updating the breaking changes now I am testing the application but I got the following error when doing a search (following is the complete stack trace of the exception https://pastebin.com/DE3DgA7h)

Elasticsearch.Net.UnexpectedElasticsearchClientException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Elasticsearch.Net.DynamicResponse.Create(IDictionary2 values) in C:\Users\russc\source\git\elasticsearch-net-5.x\src\Elasticsearch.Net\Responses\DynamicResponse.cs:line 38 at Nest.ConcreteTypeConverter.GetConcreteTypeUsingSelector[T](JsonSerializer serializer, ConcreteTypeConverter1 realConcreteConverter, JObject jObject) in C:\Users\russc\source\git\elasticsearch-net-5.x\src\Nest\CommonAbstractions\SerializationBehavior\StatefulDeserialization\ConcreteTypeConverter.cs:line 150
at Nest.ConcreteTypeConverter.GetUsingConcreteTypeConverter[T](JsonReader reader, JsonSerializer serializer, ConcreteTypeConverter1 realConcreteConverter) in C:\Users\russc\source\git\elasticsearch-net-5.x\src\Nest\CommonAbstractions\SerializationBehavior\StatefulDeserialization\ConcreteTypeConverter.cs:line 85 at Nest.DefaultHitJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in C:\Users\russc\source\git\elasticsearch-net-5.x\src\Nest\CommonAbstractions\SerializationBehavior\StatefulDeserialization\ConcreteTypeConverter.cs:line 26 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader) at Nest.JsonNetSerializer.Deserialize[T](Stream stream) in C:\Users\russc\source\git\elasticsearch-net-5.x\src\Nest\CommonAbstractions\SerializationBehavior\JsonNetSerializer.cs:line 124 at Nest.ElasticClient.FieldsSearchDeserializer[T,TResult,TRequest,TRequestParameters](IApiCallDetails response, Stream stream, TRequest d) in C:\Users\russc\source\git\elasticsearch-net-5.x\src\Nest\Search\Search\ElasticClient-ResponseCovariance.cs:line 36 at Nest.ElasticClient.<>c__DisplayClass551_04.b__0(IApiCallDetails r, Stream s) in C:\Users\russc\source\git\elasticsearch-net-5.x\src\Nest\Search\Search\ElasticClient-ResponseCovariance.cs:line 28

Here the query I am sending to Nest [1]

 {
  "function_score": {
    "score_mode": "sum",
    "boost_mode": "replace",
    "functions": [
      {
        "weight": 1.0,
        "filter": [
          {
            "match_all": {}
          }
        ]
      }
    ],
    "query": {
      "bool": {
        "should": null,
        "must": [
          {
            "terms": {
              "importBatchFileId": [
                "16",
                "17",
                "18",
                "19",
                "20",
                "21",
                "24",
                "26",
                "27",
                "28",
                "22",
                "25",
                "15",
                "23"
              ]
            }
          }
        ],
        "must_not": []
      }
    }
  }
}

And this is the response I get from elasticsearch (fragment)

{
  "took": 3,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 97,
    "max_score": 1,
    "hits": [
      {
        "_index": "2",
        "_type": "loose",
        "_id": "208",
        "_score": 1,
        "_source": { ... }
      },
      {
        "_index": "2",
        "_type": "loose",
        "_id": "222",
        "_score": 1,
        "_source": { ... }
      }
    ]
  }
}

Worth mention that I build the search using the SearchDescriptor as follows

var descriptor = new SearchDescriptor<Document>();
descriptor.TrackScores();
descriptor.Type(Types.Type(TypeName.From<TypeA>(), TypeName.From<TypeB>()));
descriptor.IgnoreUnavailable();
descriptor.Query(q => q.Bool(b => b
    .Must(
        m => m.Raw(esQuery),
        m => m.Type<LooseFile>(),
        m => m.Terms(t => t
            .Field("extension")
            .Terms(extensions)))));

esQuery is the json representation of a query (the one presented in [1])

There are other queries, these ones for aggregations that work fine, but this one that returns search results does not :-/

Thanks in advance for the help,
Manuel

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.