7.0.0 - Cannot parse hits._source into ISearchResponse.Documents
See original GitHub issueNEST/Elasticsearch.Net version: 7.0.0-alpha1
Elasticsearch version: 7.0.0
Description of the problem including expected versus actual behavior:
Hi, I’ve sent search request via Nest IElasticClient.SearchAsync() as following:
GET /player_profile*/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"LoginId": {
"query": "loginId1"
}
}
},
{
"match": {
"MobileNumber": {
"query": "loginId1"
}
}
},
{
"match": {
"Email": {
"query": "loginId1"
}
}
}
]
}
},
"_source": {
"includes": [
"PlayerId"
]
}
}
result
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 0.6931472,
"hits" : [
{
"_index" : "player_profile",
"_type" : "doc",
"_id" : "663b433e-f36b-1410-8104-004df507d47e",
"_score" : 0.6931472,
"_source" : {
"PlayerId" : "663b433e-f36b-1410-8104-004df507d47e"
}
}
]
}
}
POCO class in c#
public sealed class PlayerElkData
{
public Guid PlayerId { get; set; }
public string MobileNumber { get; set; }
public string Email { get; set; }
public string LoginId { get; set; }
}
The search result could be deserialized into ISearchResponse.Hits, however ISearchResponse.Documents and ISearchResponse.Hits[0].Source are both empty objects
It should deserialize “663b433e-f36b-1410-8104-004df507d47e” into PlayerId property
Is there something wrong in request, response or the POCO class?
Any suggestion would be appreciated, thank you!
Provide DebugInformation
(if relevant):
(some part of ip address were masked)
Valid NEST response built from a successful low level call on POST: /player_profile/_search?typed_keys=true Audit trail of this API call:
- [1] SniffOnStartup: Took: 00:00:00.2516981
- [2] SniffSuccess: Node: http://172.16..:9200/ Took: 00:00:00.2463194
- [3] PingSuccess: Node: http://172.16..:9200/ Took: 00:00:00.0203828
- [4] HealthyResponse: Node: http://172.16..:9200/ Took: 00:00:00.0987998 Request: <Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.> Response: <Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top GitHub Comments
the serializer in NEST 7.0 is stricter with regards to JSON field -> POCO property name casing. Where 6.x would be somewhat case insensitive during deserialization, 7.x is not.
The default casing is Camel casing in NEST, so the serializer looks for a
playerId
field in JSON to deserialize into thePlayerId
property. If theDefaultFieldNameInferrer()
is specified to use Pascal casing then deserialization works as expected@Mpdreamz @codebrain being more lenient here for document POCOs would have a performance impact, as it would require encoding differently cased property names into an
AutomataDictionary
against which the POCO property name is matched.Thanks @codebrain. This is something we should definitely call out 👍