Elasticsearch 5.5无法读取文件路径

时间:2019-03-07 12:24:13

标签: node.js elasticsearch-5

我正在尝试通过使用node.js获取Elasticsearch文档

以下是elasticsearch的详细信息

{
        "_index" : "media-demo-index8",
        "_type" : "media-demo-type8",
        "_id" : "5c7fb051701a21d019c5d96b",
        "_score" : 1.0,
        "_source" : {
          "path" : "2019/03/corporate_Screen-Shot-2019-03-06-at-5.04.04-PM.png",
          "slug" : "Screen-Shot-2019-03-06-at-5.04.04-PM.png",
          "desc" : "",
          "title" : "image 5",
          "video_info" : {
            "size" : "",
            "cc_url" : "",
            "poster_image" : "",
            "src_webm" : "",
            "src_ogv" : "",
            "src_mp4" : "",
            "src_youtube" : "",
            "source" : "",
            "type" : "reference"
          },
          "Dates" : {
            "modified" : "2019-03-06T11:34:41.224Z",
            "created" : "2019-03-06T11:34:41.224Z"
          },
          "friendly_name" : "media image",
          "media_date" : "03/12/2020 5:04 PM",
          "year" : "2020",
          "Flags" : {
            "archived" : false,
            "public" : true
          },
          "searchable" : true,
          "file_info" : {
            "mime_type" : "",
            "file_size" : "",
            "file_link" : ""
          }
        }
      }

尝试通过使用"path": ["2019/03/corporate_Screen-Shot-2019-03-06-at-5.04.04-PM.png"]

获得以上记录

下面是我的代码段

var client = new elasticsearch.Client({
    host: searchCfg.elasticsearchUri,
    requestTimeout: 60000
});

 client.search({
    index: searchIndex,
    type: searchType
    ,body: {
     query: {
        terms: {
          "path": ["2019/03/corporate_Screen-Shot-2019-03-06-at-5.04.04-PM.png"]
                }
             }
         }
     });

在执行此操作时获取零记录。

{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

在词条查询中使用任何特殊字符都会遇到相同的问题。有没有一种方法可以在字词查询中使用特殊字符。 请给我建议。 预先感谢!

0 个答案:

没有答案
相关问题