【发布时间】:2015-11-19 07:16:25
【问题描述】:
在我自己搭建的elasticsearch模块中,是否可以在搜索结果中返回“输入搜索词”?
例如:
GET /signals/_search
{
"query": {
"match": {
"focused_content": "stock"
}
}
}
这会返回
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.057534903,
"hits": [
{
"_index": "signals",
"_type": "signal",
"_id": "13",
"_score": 0.057534903,
"_source": {
"username": "abc@abc.com",
"tags": [
"News"
],
"content_url": "http://www.wallstreetscope.com/morning-stock-highlights-western-digital-corporation-wdc-fibria-celulose-sa-fbr-ametek-inc-ame-cott-corporation-cot-graftech-international-ltd-gti/25375462/",
"source": null,
"focused_content": "Morning Stock Highlights: Western Digital Corporation (WDC), Fibria Celulose SA (FBR), Ametek Inc. (AME), Cott Corporation (COT), GrafTech International Ltd. (GTI) - WallStreet Scope",
"time_stamp": "2015-08-12"
}
}
]
}
是否可以将输入搜索词“stock”与每个结果一起使用(如附加 JSON 键以及“content_url”、“source”、“focused_content”、“time_stamp”)来识别哪个搜索词带来了这样的结果?
提前致谢!
【问题讨论】:
标签: search elasticsearch