无法使用C#中的Nest索引对象数组

时间:2014-12-26 02:49:50

标签: elasticsearch nest

我无法使用nest索引下面的类的对象。

  class movies
{
    public string Id { get; set; }
    public string moviename { get; set; }
    public string director { get; set; }
    public string hero { get; set; }
}

电影信息存在于数据表中,我正在迭代它并尝试索引每个数据行。

var connectionSettings = new ConnectionSettings(new Uri("http://localhost:9200/movies-2014-12-17"));
connectionSettings.SetDefaultIndex("movietitles");
var elasticClient = new ElasticClient(connectionSettings);
foreach(DataRow row in dt.Rows)
        {
            i++;
            rollouts temp = new movies();
            temp.moviename = row["moviename"].ToString();
            temp.director =  row["director"].ToString();
            temp.hero = row["hero"].ToString();
            temp.Id = i.ToString();
            elasticClient.Index(temp);
          }

0 个答案:

没有答案