Skip to content

NEST DefaultIndex ConnectionSettings.DefaultIndex() is ignored #1906

Closed
@guillaume86

Description

@guillaume86

I use NEST 2.0.4 (last Nuget release) and it looks like the DefaultIndex parameter is ignored when doing a Search query.

        var node = new Uri(settings.Server); // workaround: + "/logstash-*/"
        var connectionSettings = new ConnectionSettings(node)
            .DefaultIndex("logstash-*")
            .DefaultFieldNameInferrer(p => p)
            .OnRequestCompleted(info => 
            {
                // info.Uri is /_search/ without the default index
                // my ES instance throws an error on the .kibana index (@timestamp field not mapped because I sort on @timestamp) 
            });

        var client = new ElasticClient(connectionSettings);
        var response = client.Search<ESLogEvent>(...);

I can workaround by giving the index in the base URL but it's just a ugly hack.

Side note: IApiCallDetails contains null for request and body bytes, is it expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions