elasticsearch 如何在ElasticSearch 0.9中合并HighlightField结果和SearchHitField结果
我的代码是这样的:
elasticsearch 如何在ElasticSearch 0.9中合并HighlightField结果和SearchHitField结果,
elasticsearch,merge,
elasticsearch,Merge,我的代码是这样的: { "took" : 7, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 2, "max_score" : 0.29792547, "hits" : [ { "_index" : "pim", "_ty
{
"took" : 7,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 0.29792547,
"hits" : [ {
"_index" : "pim",
"_type" : "contact",
"_id" : "8a92e6e5335f724b013361dacd1225bd",
"_score" : 0.29792547,
"fields" : {
"id" : "8a92e6e5335f724b013361dacd1225bd",
"phone" : [ {
"op" : "China Mobile",
"number" : "13681011893"
}, {
"op" : "China Mobile",
"number" : "13681011893"
}, {
"op" : "China Mobile",
"number" : "13681011893"
} ],
},
"highlight" : {
"phone.number" : [ "1368101189<span class=\"hl\">136810</
span>3", "1368101189<span class=\"hl\">136810</span>3",
"1368101189<span class=\"hl\">136810</span>3" ]
}
}]
}
}
{
“take”:7,
“超时”:false,
“_碎片”:{
“总数”:5,
“成功”:5,
“失败”:0
},
“点击次数”:{
“总数”:2,
“最高分数”:0.29792547,
“点击次数”:[{
“_索引”:“pim”,
“_类型”:“联系人”,
“_id”:“8a92e6e5335f724b013361dacd1225bd”,
“_分数”:0.29792547,
“字段”:{
“id”:“8a92e6e5335f724b013361dacd1225bd”,
“电话”:[{
“op”:“中国移动”,
“编号”:“13681011893”
}, {
“op”:“中国移动”,
“编号”:“13681011893”
}, {
“op”:“中国移动”,
“编号”:“13681011893”
} ],
},
“突出显示”:{
“电话号码”:[“13681011891368103”,“13681011891368103”,
"13681011891368103" ]
}
}]
}
}
实际上,我想要这个结果:
{
"took" : 7,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 0.29792547,
"hits" : [ {
"_index" : "pim",
"_type" : "contact",
"_id" : "8a92e6e5335f724b013361dacd1225bd",
"_score" : 0.29792547,
"fields" : {
"id" : "8a92e6e5335f724b013361dacd1225bd",
"phone" : [ {
"op" : "China Mobile",
"number" : "<span class=\"hl\">136810</span>11893"
}, {
"op" : "China Mobile",
"number" : "<span class=\"hl\">136810</span>11893"
}, {
"op" : "China Mobile",
"number" : "<span class=\"hl\">136810</span>11893"
} ],
}
}]
}
}
{
“take”:7,
“超时”:false,
“_碎片”:{
“总数”:5,
“成功”:5,
“失败”:0
},
“点击次数”:{
“总数”:2,
“最高分数”:0.29792547,
“点击次数”:[{
“_索引”:“pim”,
“_类型”:“联系人”,
“_id”:“8a92e6e5335f724b013361dacd1225bd”,
“_分数”:0.29792547,
“字段”:{
“id”:“8a92e6e5335f724b013361dacd1225bd”,
“电话”:[{
“op”:“中国移动”,
“编号”:“13681011893”
}, {
“op”:“中国移动”,
“编号”:“13681011893”
}, {
“op”:“中国移动”,
“编号”:“13681011893”
} ],
}
}]
}
}
也就是说,我们应该得到elasticsearch搜索的原始源内容和突出显示内容之间的结果,有人能帮我吗??