【发布时间】:2019-02-02 13:05:32
【问题描述】:
我在 elasticsearch 中使用 NEST 来处理请求。将数据保存到elasticsearch时出现错误。
请求:PUT: /strategy/30772377 {"id": 1, "name": "strategy1"}
保存时,NEST 返回错误。
我的代码:
var settings = new ConnectionSettings(new StaticConnectionPool(uri));
var client = new ElasticClient(settings);
var response = await client.IndexAsync(
model,
x => x.Type(indexType).Index(indexName),
cancellationToken).ConfigureAwait(false);
错误:
NEST.Response.DebugInformation:
从对 PUT 的不成功的低级别调用构建的无效 NEST 响应: /strategy/30772377
此 API 调用的审核跟踪: - [1] 错误响应:节点:http://localhost:9200/ 接受:00:00:51.9406716 - [2] CancellationRequested:花费:00:00:00
OriginalException: Elasticsearch.Net.ElasticsearchClientException: The 请求被中止:请求被取消。呼叫:状态代码 未知来自:PUT /strategy/30772377 --->
System.Net.WebException:请求被中止:请求被 取消。在 System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 在 System.Threading.Tasks.TaskFactory
1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean 需要同步) --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在 Elasticsearch.Net.HttpWebRequestConnection。d__5`1.MoveNext() --- 内部异常堆栈结束 追踪---
请求:{"id": 1, "name": "strategy1"}
回复:
【问题讨论】:
标签: c# elasticsearch nest