Sahil Sharma
Sahil Sharma

Reputation: 4247

NEST connecting: ConnectionSettings does not have parameter 'defaultIndex'

 public class Class1
    {
        public static Uri node;
        public static ConnectionSettings settings;
        public static ElasticClient client;

        public static void Main(string[] args)
        {
            node = new Uri("http://localhost:9200");
            settings = new ConnectionSettings(node, defaultIndex: "my-application");
            var client = new ConnectionSettings(settings);
        }
    }

I get this error when i build this code. I am referring: Elastic search doc: elastic search nest doc Nest doc: Nest doc

I have NEST 2.0.2 version with VS Express 2015 for web. I think documentation is for old versions of NEST. Can someone please suggest me some latest doc or what can be solution for this?

Upvotes: 0

Views: 1414

Answers (1)

core
core

Reputation: 871

The default index can be set by a method of ConnectionSettings:

public class Class1
{
    public static Uri node;
    public static ConnectionSettings settings;
    public static ElasticClient client;

    public static void Main(string[] args)
    {
        node = new Uri("http://localhost:9200");
        settings = new ConnectionSettings(node);
        settings.DefaultIndex("my-application");
        var client = new ElasticClient(settings);
    }
}

Upvotes: 3

Related Questions