elasticsearch NEST compile error

  • Thread starter Thread starter kobosh3
  • Start date Start date
K

kobosh3

Guest
I am following through with
nest-quick-start.html
nest-quick-start.html
Elasticsearch.Net and NEST quick start. I get compile error:

Error CS1503 Argument 1: cannot convert from 'Person' to 'Nest.IIndexRequest<Person>'

at client.index(p) in code below

using Nest;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ElasticCons
{
public class Person
{
public string Id { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
}

class Program
{
static void Main(string[] args)
{
Person p = new Person { Id = "1", Firstname = "hass",Lastname="ab" };
var node = new Uri("http://localhost:9200");

var settings = new ConnectionSettings(
node
//defaultIndex: "myapp" causes error if not //commented out
);
settings.DefaultIndex("myapp"); //no problem

var client = new ElasticClient(settings); //no problem

var indx = client.Index(p);//error
}
}
}

Continue reading...
 
Back
Top