public void IndexCommonStockInfo() { var client = new ElasticClient(new ConnectionSettings(new Uri("http://localhost:9200")) .DefaultIndex("theset")); var repo = new IndexRepository(client); try { repo.IndexData <CommonStockInfo>(_collection.FirstOrDefault(), "set", "commonstockinfo"); } catch (Exception ex) { Console.Write(ex.Message); } }