菜鳥在ElasticSearch
和在這裏築巢。不完全知道我在做什麼錯在這裏,但是這個代碼拋出了
巢(Elasticsearch客戶端C#)散貨指數
「格式不正確動作/元數據線[1],預計START_OBJECT或END_OBJECT卻發現[VALUE_NUMBER]」。
我知道ES正在拋出此錯誤,因爲JSON is malformed
。我不知道爲什麼Nest不生成正確的JSON?
注:我希望能夠做批量指數操作,同時告訴它哪個指數,並輸入該有效載荷應該去。
public class Test
{
private static Uri _node;
private ElasticsearchClient _client;
static Test()
{
_node = new Uri("http://localhost:9200");
}
public Test()
{
_client = new ElasticsearchClient(new ConnectionSettings(_node));
}
public void Bulk<T>(List<T> data, string index, string type) where T : class
{
_client.Bulk(index, type, data);
}
}
你用什麼版本NEST和ES的下面?你可以分享你想要索引的類型嗎? – Rob