【问题标题】:ElasticSearch, specific field not returningElasticSearch,特定字段未返回
【发布时间】:2012-07-03 21:36:51
【问题描述】:

我遇到了一点弹性搜索问题。我是 elasticsearch 新手,不知道为什么这不起作用。

curl -XPOST 'http://myhost.nl:9200/my_index/test/_search?pretty=true' -d '{ "fields": ["message"] }'

我没有取回任何字段。 “消息”字段确实存在,并且看起来像弹性搜索网站上的示例。 http://www.elasticsearch.org/guide/reference/api/search/fields.html

谁能看到我错过了什么?

【问题讨论】:

  • 您可以为您的测试类型添加映射定义吗?您可以通过运行 curl myhost.nl:9200/my_index/test/_mapping 来查找它
  • 对不起,我不能为你美化它 {"test":{"properties":{"query":{"dynamic":"true","properties":{"query_string": {"dynamic":"true","properties":{"fields":{"type":"string"},"query":{"type":"string"}}},"querystring":{"动态":"true","properties":{"fields":{"type":"string"},"query":{"type":"string"}}}}},"tweet":{"动态":"true","properties":{"message":{"type":"string"},"post_date":{"type":"date","format":"dateOptionalTime"},"user ":{"type":"string"}}}}}}

标签: json elasticsearch


【解决方案1】:

如果已存储此字段,您的查询将有效。但由于它没有存储并且仅作为源的一部分提供,因此您需要指定它的完整路径。试试:

curl -XPOST 'http://myhost.nl:9200/my_index/test/_search?pretty=true' -d '{ "fields": ["tweet.message"] }'

【讨论】:

    猜你喜欢
    • 2015-06-11
    • 2020-01-05
    • 1970-01-01
    • 2021-11-10
    • 1970-01-01
    • 1970-01-01
    • 2012-10-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多