4

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.

1 Answer 1

1

You're using new InMemoryConnection() in your ConnectionSettings, try removing that.

Sign up to request clarification or add additional context in comments.

1 Comment

Is it not possible to search data held in memory with elastic?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.