【发布时间】:2017-11-09 22:01:13
【问题描述】:
我正在尝试按照 Elastic 5.x 上的新标准对访问其内部关键字字段的文本属性执行 Term 过滤器...
我有这样一个属性:
{
"foo": {
"type" "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
我正在运行以下代码以使用内部关键字字段进行过滤...
var searchResult = _elasticClient.Search<InvoiceResult>(x => x
.Index("my_index")
.Query(query => query
.Term(term => term
.Field(new Field("foo.keyword"))
.Value("TEST")
)
)
);
有没有什么方法可以使用模型类达到相同的结果?当我尝试下面的代码时,它从不使用关键字内部字段。
var searchResult = _elasticClient.Search<InvoiceResult>(x => x
.Index("my_index")
.Query(query => query
.Term(term => term
.Field(field => field.Foo)
.Value("TEST")
)
)
);
干杯!
【问题讨论】:
标签: .net elasticsearch nest