elasticsearch-net icon indicating copy to clipboard operation
elasticsearch-net copied to clipboard

BulkAsync serializes document with all fields as empty array

Open KPGDL opened this issue 4 months ago • 1 comments

Elastic.Clients.Elasticsearch version: 8.12 Elasticsearch version: 8.5.3 .NET runtime version: .NET7 Operating system version: Ubuntu Description of the problem including expected versus actual behavior: Serialization fails on object type - this didn't happen on NEST 7.17.x Of course this doesn't happen for strongly-typed objects passed to the method(s). image

Steps to reproduce:

  1. Pass IEnumerable<object> (anonymous objects) to the BulkAll/BulkAsync (UpdateMany)
  2. See all properties are empty arrays []

Expected behavior Serialize property values properly.

Provide ConnectionSettings (if relevant):

Provide DebugInformation (if relevant):

{"Errors":false,"IngestTook":null,"Took":5,"Items":[{"Operation":"update","Id":"new_id","Index":"my-index","PrimaryTerm":45,"SeqNo":2190,"Shards":{"Failed":0,"Failures":null,"Skipped":null,"Successful":1,"Total":2},"Version":1,"Error":null,"ForcedRefresh":null,"Get":null,"Result":"created","Status":201,"IsValid":true}],"ItemsWithErrors":[],"IsValidResponse":true,"ElasticsearchWarnings":[],"DebugInformation":"Valid Elasticsearch response built from a successful (200) low level call on POST: /my-index/_bulk?pretty=true&error_trace=true\n\n# Audit trail of this API call:\n - [1] HealthyResponse: Node: http://elasticsearch:9200/ Took: 00:00:00.0105041\n# Request:\n{\"update\":{\"_id\":\"new_id\"}}\n{\"doc\":{\"Id\":[],\"Status\":[],\"NestedArray\":[[[[]],[[]]]]},\"doc_as_upsert\":true}\n\n# Response:\n{\n  \"took\" : 5,\n  \"errors\" : false,\n  \"items\" : [\n    {\n      \"update\" : {\n        \"_index\" : \"my-index\",\n        \"_id\" : \"new_id\",\n        \"_version\" : 1,\n        \"result\" : \"created\",\n        \"_shards\" : {\n          \"total\" : 2,\n          \"successful\" : 1,\n          \"failed\" : 0\n        },\n        \"_seq_no\" : 2190,\n        \"_primary_term\" : 45,\n        \"status\" : 201\n      }\n    }\n  ]\n}\n\n# TCP states:\n  TimeWait: 1\n  Established: 2\n\n# ThreadPool statistics:\n  Worker: \n    Busy: 2\n    Free: 32765\n    Min: 8\n    Max: 32767\n  IOCP: \n    Busy: 0\n    Free: 1000\n    Min: 1\n    Max: 1000\n\n","ElasticsearchServerError":null,"ApiCallDetails":{"AuditTrail":[{"Event":10,"Node":{"Features":[],"Settings":{},"Id":null,"Name":null,"Uri":"http://elasticsearch:9200/","IsAlive":true,"DeadUntil":"0001-01-01T00:00:00+00:00","FailedAttempts":0,"IsResurrected":true},"PathAndQuery":"my-index/_bulk?pretty=true&error_trace=true","Ended":"2024-02-14T14:51:42.6249566+00:00","Started":"2024-02-14T14:51:42.6144525+00:00","Exception":null}],"DebugInformation":"Successful (200) low level call on POST: /my-index/_bulk?pretty=true&error_trace=true\n\n# Audit trail of this API call:\n - [1] HealthyResponse: Node: http://elasticsearch:9200/ Took: 00:00:00.0105041\n# Request:\n{\"update\":{\"_id\":\"new_id\"}}\n{\"doc\":{\"Id\":[],\"Status\":[],\"NestedArray\":[[[[]],[[]]]]},\"doc_as_upsert\":true}\n\n# Response:\n{\n  \"took\" : 5,\n  \"errors\" : false,\n  \"items\" : [\n    {\n      \"update\" : {\n        \"_index\" : \"my-index\",\n        \"_id\" : \"new_id\",\n        \"_version\" : 1,\n        \"result\" : \"created\",\n        \"_shards\" : {\n          \"total\" : 2,\n          \"successful\" : 1,\n          \"failed\" : 0\n        },\n        \"_seq_no\" : 2190,\n        \"_primary_term\" : 45,\n        \"status\" : 201\n      }\n    }\n  ]\n}\n\n# TCP states:\n  TimeWait: 1\n  Established: 2\n\n# ThreadPool statistics:\n  Worker: \n    Busy: 2\n    Free: 32765\n    Min: 8\n    Max: 32767\n  IOCP: \n    Busy: 0\n    Free: 1000\n    Min: 1\n    Max: 1000\n\n","HttpMethod":1,"HttpStatusCode":200,"OriginalException":null,"RequestBodyInBytes":"eyJ1cGRhdGUiOnsiX2lkIjoibmV3X2lkIn19CnsiZG9jIjp7IklkIjpbXSwiU3RhdHVzIjpbXSwiTmVzdGVkQXJyYXkiOltbW1tdXSxbW11dXV19LCJkb2NfYXNfdXBzZXJ0Ijp0cnVlfQo=","ResponseBodyInBytes":"ewogICJ0b29rIiA6IDUsCiAgImVycm9ycyIgOiBmYWxzZSwKICAiaXRlbXMiIDogWwogICAgewogICAgICAidXBkYXRlIiA6IHsKICAgICAgICAiX2luZGV4IiA6ICJ1bmlmaWVkLXByb2R1Y3RzLTIwMjItMDEtMDEiLAogICAgICAgICJfaWQiIDogIm5ld19pZCIsCiAgICAgICAgIl92ZXJzaW9uIiA6IDEsCiAgICAgICAgInJlc3VsdCIgOiAiY3JlYXRlZCIsCiAgICAgICAgIl9zaGFyZHMiIDogewogICAgICAgICAgInRvdGFsIiA6IDIsCiAgICAgICAgICAic3VjY2Vzc2Z1bCIgOiAxLAogICAgICAgICAgImZhaWxlZCIgOiAwCiAgICAgICAgfSwKICAgICAgICAiX3NlcV9ubyIgOiAyMTkwLAogICAgICAgICJfcHJpbWFyeV90ZXJtIiA6IDQ1LAogICAgICAgICJzdGF0dXMiIDogMjAxCiAgICAgIH0KICAgIH0KICBdCn0K","HasSuccessfulStatusCode":true,"HasExpectedContentType":true,"Uri":"http://elasticsearch:9200/my-index/_bulk?pretty=true&error_trace=true"}}

KPGDL avatar Feb 14 '24 14:02 KPGDL