Reputation: 337
Forgive me if this is redundant or I'm missing something simple, but I'm playing around with ElasticSearch (and NEST in particular) to see if it would be a good add for our b2b ecommerce site's search function.
I grabbed the latest NuGet of NEST and then tried to serialize and add something to an index. Here is a snippet of the approach I was using
var localhost = new Uri("http://localhost/9200");
var setting = new ConnectionSettings(localhost).SetDefaultIndex("cpi_catalog");
var client = new ElasticClient(setting);
client.MapFromAttributes<Item>();
var testitem = new Item()
{
Description = "test",
Id = 9999999,
Manufacturer_Id = 5,
Quantity_Per_Unit = 1,
Quantity_Unit_Id = "EA",
SKU = "AVE29845",
Subtitle = "test",
Title = "test"
};
var status = client.Index(testitem);
However, it seems that testitem is never indexed at all, when I do a GET for /cpi_catalog/items/9999999 I get the following:
{"_index":"cpi_catalog","_type":"items","_id":"9999999","exists":false}
What seemingly simple thing am I missing here?
EDIT: When debugging, I get back a Nest.IndexResponse
with all fields NULL
besides status.OK
which is false
Upvotes: 0
Views: 446
Reputation: 13536
Seems like the uri is has a typo:
var localhost = new Uri("http://localhost/9200");
should probably be:
var localhost = new Uri("http://localhost:9200");
Upvotes: 2