是否可以通过索引名称来推断 Elasticsearch 文档的类型,因为我试图调用多个索引并且必须使用object
类型。
var indices = Indices.Index(entities);
var search = new SearchRequest(indices)
{
From = page,
Size = pageSize,
Query = fullQuery,
IgnoreUnavailable = true,
};
var response = this.client.Search<object>(search);
是否可以基于某种type / indexName映射从 Elasticsearch 中推断出每个对象的类型?
最佳答案
也许您可以尝试泛型。
var indices = Indices.Index(entities);
var search = new SearchRequest(indices)
{
From = page,
Size = pageSize,
Query = fullQuery,
IgnoreUnavailable = true,
};
var response = this.client.Search<T>(search);
return response;
关于elasticsearch - 从NEST中的索引名称推断 Elasticsearch 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60826810/