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

Invalid serialization of reindex request when using op type

Open gpetrou opened this issue 6 months ago • 0 comments

Elastic.Clients.Elasticsearch version: 8.11.0

Elasticsearch version: 8.2.2

.NET runtime version: net8.0

Operating system version: Windows 11

Description of the problem including expected versus actual behavior: Trying to use ReindexAsync with OpType results in an invalid request.

Steps to reproduce:

Elastic.Clients.Elasticsearch.ReindexRequest request = new()
{
    Source = new Elastic.Clients.Elasticsearch.Core.Reindex.Source()
    {
         Index = Elastic.Clients.Elasticsearch.Indices.Parse("test-src")
    },
    Dest = new Elastic.Clients.Elasticsearch.Core.Reindex.Destination()
    {
         Index = "test-dest",
         OpType = Elastic.Clients.Elasticsearch.OpType.Create
    }
};

var response = await _elasticsearchClient.ReindexAsync(request);
{
  "dest": {
    "index": "test-dest",
    "op_type": {
      "value": "create"
    }
  },
  "source": {
    "index": "test-src"
  }
}

ServerError: Type: x_content_parse_exception Reason: "[4:16] [reindex] failed to parse field [dest]" CausedBy: "Type: x_content_parse_exception Reason: "[4:16] [dest] op_type doesn't support values of type: START_OBJECT""

Expected behavior The request works.

Provide ConnectionSettings (if relevant):

Provide DebugInformation (if relevant):

gpetrou avatar Dec 22 '23 07:12 gpetrou