【问题标题】:Elasticsearch match query not workingElasticsearch 匹配查询不起作用
【发布时间】:2018-04-10 10:06:50
【问题描述】:

我在 elasticsearch 中有 4 个文档。下面是它的样子

我正在尝试仅在 title 中提到单词 Python 的地方查询文档。我正在使用head 插件,下面是我传递的 GET 命令。

但是,我没有获取提到Python 的文档,而是获取所有文档。

{
"took": 8,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 1,
"hits": [
{
"_index": "library",
"_type": "book",
"_id": "2",
"_score": 1,
"_source": {
"title": "Building machine learning systems in JAVA",
"publish_date": "July 2014",
"price": 59.9
}
}
,
{
"_index": "library",
"_type": "book",
"_id": "4",
"_score": 1,
"_source": {
"title": "Building machine learning systems in C++",
"publish_date": "July 2016",
"price": 79.9
}
}
,
{
"_index": "library",
"_type": "book",
"_id": "1",
"_score": 1,
"_source": {
"title": "Building machine learning systems in Python",
"publish_date": "July 2013",
"price": 49.9
}
}
,
{
"_index": "library",
"_type": "book",
"_id": "3",
"_score": 1,
"_source": {
"title": "Building machine learning systems in SCALA",
"publish_date": "July 2015",
"price": 69.9
}
}
]
}
}

不知道我错过了什么

【问题讨论】:

标签: elasticsearch


【解决方案1】:

这可能是由您用于发送请求的工具引起的。 GET with body 通常不被支持。请改用POST

【讨论】:

  • 谢谢!!它确实有帮助。我将尝试更改我正在使用的工具。虽然PUT 命令工作得很好,但它很奇怪。
  • 支持PUT与正文
猜你喜欢
  • 1970-01-01
  • 2018-06-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-11
  • 2017-07-08
相关资源
最近更新 更多