我正在尝试使用地理位置实现function_score,类似于弹性搜索地理距离排序中描述的内容.但是,我的文档geo-location字段位于一个具有嵌套映射的数组中.
{
"mappings": {
"bo_contentmodel": {
"properties": {
"contentId": {
"type": "double"
},
"contentName": {
"type": "string",
"index": "no"
},
"geoInfo": {
"type": "nested",
"properties": {
"geoPhone": {
"type": "string",
"index": "no"
},
"geoTitle": {
"type": "string",
"index": "no"
},
"point": {
"type": "geo_point"
}
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
执行以下查询时:
{
"from": 0,
"size": 6,
"query": {
"function_score": {
"query": {
"match_all": {}
},
"functions": [{
"filter": {
"nested": {
"query": {
"geo_distance": { …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用ElasticSearch 5.1.2上的Nest 5.0创建一个带有上下文建议的索引.
目前,我可以创建映射:
elasticClient.MapAsync<EO_CategoryAutocomplete>(m => m
.Properties(p => p
.Completion(c => c
.Contexts(ctx => ctx
.Category(csug => csug
.Name("lang")
.Path("l")
)
.Category(csug => csug
.Name("type")
.Path("t")
)
.Category(csug => csug
.Name("home")
.Path("h")
)
)
.Name(n => n.Suggest)
)
)
);
Run Code Online (Sandbox Code Playgroud)
但在POCO类我不知道什么对象类型必须是标题为?????的建议属性 :
public class EO_CategoryAutocomplete
{
public string Id { get; set; }
public ????? Suggest { get; set; }
}
public class EO_CategoryAC
{
public int Id { get; set; }
public string …Run Code Online (Sandbox Code Playgroud)