【发布时间】:2016-02-11 21:33:32
【问题描述】:
我似乎无法在 NEST 2.0 中获得正确的多字段映射语法——如果这是正确的术语。我发现的每个映射示例似乎都是
基本上,我不需要索引或存储整个类型。有些字段我只需要索引,有些字段我需要索引和检索,还有一些我不需要索引,只是为了检索。
MyType
{
// Index this & allow for retrieval.
int Id { get; set; }
// Index this & allow for retrieval.
// **Also**, in my searching & sorting, I need to sort on this **entire** field, not just individual tokens.
string CompanyName { get; set; }
// Don't index this for searching, but do store for display.
DateTime CreatedDate { get; set; }
// Index this for searching BUT NOT for retrieval/displaying.
string CompanyDescription { get; set; }
// Nest this.
List<MyChildType> Locations { get; set; }
}
MyChildType
{
// Index this & allow for retrieval.
string LocationName { get; set; }
// etc. other properties.
}
我已经能够使用以下示例按原样索引整个对象和子对象:
client.Index(item, i => i.Index(indexName));
但是,实际的对象比这个大很多,我真的不需要大部分。我找到了这个,这看起来像是我想做的,但在旧版本中:multi field mapping elasticsearch
我认为“映射”是我想要的,但就像我说的,我是 Elasticsearch 和 NEST 的新手,我正在努力学习这些术语。
要温柔! :) 这是我第一次就 SO 提出问题。谢谢!
【问题讨论】:
标签: c# elasticsearch nest