【发布时间】:2018-09-06 18:15:37
【问题描述】:
我正在使用 .NET NEST 在 Elasticsearch 中进行搜索。
当我索引一个文档并立即搜索它时找不到它:
var node = new Uri("http://localhost:9200");
var settings = new ConnectionSettings(node);
settings.DefaultIndex("products_test");
settings.DisableDirectStreaming(true);
ElasticClient client = new ElasticClient(settings);
Product p = new Product("My Product", "6");
client.IndexDocument(p);
var results = client.Search<Product>(s => s.Query(q => q.MatchAll()));
results.HitsMetadata.Total //is 0 and results.Hits are empty
为什么?
我必须以某种方式提交吗?
谢谢
编辑:但是当我再次运行控制台应用程序并注释掉创建时,找到了文档。
【问题讨论】:
标签: .net elasticsearch nest