2

I am having error when calling client.Index when using Nest and Elasticsearch.NET

var httpConnection = new AwsHttpConnection(new AwsSettings
{
    AccessKey = "AKIAIFIV4LN6XZAFVX7Q",
    SecretKey = "MySecretKey",
    Region = "us-east-1",
});

var pool = new SingleNodeConnectionPool(new Uri(sSearchURI));
var config = new ConnectionSettings(pool, httpConnection);
var client = new ElasticClient(config);
var person = new Person
{
    Id = "1",
    Firstname = "Martijn",
    Lastname = "Laarman"
};
var index = client.Index(person);

Dispatching Index() from NEST into to Elasticsearch.NET failed
Received a request marked as PUT This endpoint accepts POST,PUT The request might not have enough information provided to make any of these endpoints:
- /{index}/{type}
- /{index}/{type}/{id}

Any idea?

1
  • It seems it cannot infer either the index or the type information. Just to test this theory, can you try the more explicit way: client.Index(person, i => i.Index("persons").Type("person").Id(person.Id)); ? Commented Feb 27, 2016 at 5:26

1 Answer 1

7

You need to set the default index:

settings.DefaultIndex("indexName");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.