I have a simple Dummy document in C#. I am trying to index it into elasticsearch for the first time using NEST client. But automaping is not working.
My dummy document is:
class DummyRecord {
public string RecordName;
public int RecordId;
}
And the main program is:
class Program
{
static void Main(string[] args)
{
var node = new Uri("http://localhost:9200");
var settings = new ConnectionSettings(node).DefaultTypeName("_doc");
var client = new ElasticClient(settings);
var doc = new DummyRecord {
RecordName = "SOmething",
RecordId = 1
};
var creaeIndexRespone = client.CreateIndex("DummyIndex",c => c.Mappings(ms=> ms.Map<DummyRecord>(m => m.AutoMap())));
Console.WriteLine(creaeIndexRespone);
var response = client.Index(doc, idx => idx.Index("DummyIndex"));
Console.WriteLine(response);
Console.ReadKey();
}
}
All I am getting is the following output:
Invalid NEST response built from a unsuccessful low level call on PUT: /DummyIndex
Invalid NEST response built from a unsuccessful low level call on POST: /DummyIndex/_doc
How to get this thing working. Is there anything I have to do while creating the settings more than this??
var settings = new ConnectionSettings(node).DefaultTypeName("_doc");