将 Index() 从 NEST 调度到 Elasticsearch.NET 失败
Dispatching Index() from NEST into to Elasticsearch.NET failed
我在使用 Nest 和 Elasticsearch.NET
时调用 client.Index
时出错
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}
有什么想法吗?
您需要设置默认索引:
settings.DefaultIndex("indexName");
我在使用 Nest 和 Elasticsearch.NET
时调用client.Index
时出错
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}
有什么想法吗?
您需要设置默认索引:
settings.DefaultIndex("indexName");