簡體   English   中英

NEST沒有索引

[英]NEST not indexing

請原諒我,如果這是多余的,或者我錯過了一些簡單的東西,但我正在玩ElasticSearch(尤其是NEST),看看它是否是我們b2b電子商務網站搜索功能的一個很好的補充。

我抓住了最新的NEST NuGet,然后嘗試序列化並向索引添加內容。 這是我正在使用的方法的片段

        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);

但是,似乎testitem從未編入索引,當我為/ cpi_catalog / items / 9999999執行GET時,我得到以下內容:

{"_index":"cpi_catalog","_type":"items","_id":"9999999","exists":false}

我在這里錯過了什么看似簡單的事情?

編輯:調試時,我返回一個Nest.IndexResponse ,除了status.OK之外所有字段都是NULL ,這是false

好像uri有一個拼寫錯誤:

var localhost = new Uri("http://localhost/9200");

應該是:

var localhost = new Uri("http://localhost:9200");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM