简体   繁体   中英

Dispatching Index() from NEST into to Elasticsearch.NET failed

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?

您需要设置默认索引:

settings.DefaultIndex("indexName");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM