使用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);
从NEST调度Index()到Elasticsearch.NET失败
收到标记为PUT的请求此端点接受POST,PUT 请求可能没有提供足够的信息来制作任何 这些终点:
- / {index} / {type}
- / {index} / {type} / {id}
有什么想法吗?
答案 0 :(得分:7)
您需要设置默认索引:
settings.DefaultIndex("indexName");