Reputation: 41
I am trying to create a new Elastic 5 index from .net and data from a SQL database into it using the bulk API.
I have created a POCO for mapping:
using Nest;
namespace NEST5
{
[ElasticsearchType(IdProperty = "data_id")]
public class Test_Data
{
public int data_id { get; set; }
public string address { get; set; }
public string location { get; set; }
}
}
And I am getting the data from SQL into a list of type Test_Data
Then I am trying to connect to my Elasticsearch server and create an index:
var connectionPool = new SingleNodeConnectionPool(new Uri("http://<ip here>:9200/"));
var settings = new ConnectionSettings(connectionPool, new InMemoryConnection())
.DefaultIndex("test_data")
.BasicAuthentication("username", "password");
var client = new ElasticLowLevelClient(settings);
var descriptor = new CreateIndexDescriptor("test_data")
.Mappings(ms => ms
.Map<Test_Data>(m => m.AutoMap())
);
client.IndicesCreate<Test_Data>("test_data", descriptor, null);
However, this does not show an error, but is not creating a new index as required either.
Thank you in advance for any assistance.
Upvotes: 4
Views: 1463
Reputation: 2316
You're using new InMemoryConnection()
in your ConnectionSettings
, try removing that.
Upvotes: 1