所以我最终得到了一个带有一些数据的Elasticsearch索引。如果我执行以下查询:
GET myindex/_search
{ "query" : {
"match" : {"content": "perky"}
}
我收到以下输出:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1.641338,
"hits": [
{
"_index": "myindex",
"_type": "doc",
"_id": "b9c08da824e715ec1219d72d66904ce0",
"_score": 1.641338,
"_source": {
"content": "pinky perky dave\n",
"meta": {
"raw": {
"X-Parsed-By": "org.apache.tika.parser.DefaultParser",
"Content-Encoding": "ISO-8859-1",
"Content-Type": "text/plain; charset=ISO-8859-1"
}
},
"file": {
"extension": "txt",
"content_type": "text/plain; charset=ISO-8859-1",
"last_modified": "2017-08-04T14:57:03.593+0000",
"indexing_date": "2017-08-04T14:57:25.795+0000",
"filesize": 16,
"filename": "testsub.txt",
"url": """file://w:\Elasticsearch\Docs\DocsSub\testsub.txt"""
},
"path": {
"root": "f8297de277471c98cd8d97615cb13e9f",
"virtual": "/DocsSub/testsub.txt",
"real": """w:\Elasticsearch\Docs\DocsSub\testsub.txt"""
}
}
}
]
}
}
所以我的问题是,我如何匹配内容,但只返回raw
内容行(即路径和文件名)?
答案 0 :(得分:0)
`GET myindex/_search?q='perky'&filter_path=hits.hits._source.path.real`