【发布时间】:2016-02-28 19:59:44
【问题描述】:
我在使用 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);
将 Index() 从 NEST 分派到 Elasticsearch.NET 失败
收到一个标记为 PUT 的请求 这个端点接受 POST,PUT 的 请求可能没有提供足够的信息来进行任何 这些端点:
- /{index}/{type}
- /{index}/{type}/{id}
有什么想法吗?
【问题讨论】:
-
它似乎无法推断索引或类型信息。只是为了检验这个理论,你可以尝试更明确的方式:
client.Index(person, i => i.Index("persons").Type("person").Id(person.Id));吗?
标签: c# elasticsearch nest