【问题标题】:Elasticsearch how do I return just the 'real' pathElasticsearch 如何只返回“真实”路径
【发布时间】:2017-08-07 07:31:00
【问题描述】:

所以我终于有了一个包含一些数据的 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 内容行(即路径和文件名)?

【问题讨论】:

标签: elasticsearch


【解决方案1】:

Val 向我指出了答案,如果它是一个答案而不是评论,我会给他答案打勾。我最终的完整答案是:

`GET myindex/_search?q='perky'&filter_path=hits.hits._source.path.real`

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-07-20
    • 2023-04-01
    • 2017-01-31
    • 1970-01-01
    • 1970-01-01
    • 2021-05-23
    • 1970-01-01
    相关资源
    最近更新 更多