Skip to content

The fields property on TermVectorsRequestDescriptor is serialized incorrectly with one field #8641

@Hesehus-ASAL

Description

@Hesehus-ASAL

Elastic.Clients.Elasticsearch version:9.1.0

Elasticsearch version:9.1.0

.NET runtime version:.net 9.0

Operating system version: Windows 11

Description of the problem including expected versus actual behavior:
The fields property on TermVectorsRequestDescriptor is serialized incorrectly. If there are only one field, the request is :
{"fields":"test_field"} it should be: {"fields":["test_field"]}

Steps to reproduce:

This code causes a badrequest:

     var termVectorsRequestDescriptor = new TermVectorsRequestDescriptor<MyDocument>(indexName)
                  .Id(hit.Id)
                  .Preference(NodePreferenceHelper.GetNodePreference(node))
                  .Fields(new[]{Field.FromString("test_field")});

    var termVectorResult =
        await _elasticsearchClient.TermvectorsAsync(termVectorsRequestDescriptor, cancellationToken);

Expected behavior
The request is serialized as {"fields":["test_field"]}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions