【问题标题】:searched content cannot retrieved in elasticsearch搜索到的内容无法在 elasticsearch 中检索
【发布时间】:2016-07-04 17:54:44
【问题描述】:

我是弹性搜索的新手。我在尝试搜索内容后在弹性搜索中索引了一些内容,它将显示弹性搜索索引中的所有内容,搜索算法可能不适用。映射字段如下所述。

    {
                      "groupId": {
                          "type": "integer",
                          "index": "not_analyzed"

                      },
                      "createrId": {
                      "type": "integer",
                          "index": "not_analyzed"
                      },
                      "name": {
                          "type": "string",
                          "index": "not_analyzed"
                      },
                      "comments": {
                          "type": "string",
                          "index": "not_analyzed"
                      },
                      "createdOn": {
                          "type":"date","format":"date_optional_time", "index":    "not_analyzed"
                      },
                      "status": {
                          "type": "integer",
                          "analyzer":"keyword_lowercase"
                      },
                      "description": {
                          "type": "string",
                          "index": "not_analyzed"
                      },
                      "visibility": {
                          "type": "integer",
                          "analyzer":"keyword_lowercase"
                      },
                      "userGroupAssociationCount": {
                          "type": "integer",
                          "index": "not_analyzed"
                      },
                      "associatedUserIds" :{
                        "analyzer":"keyword_lowercase",
                        "type": "string"
                      },
                      "createrFriendsId":{
                        "analyzer":"keyword_lowercase",
                        "type": "string"
                      }
}

搜索查询是:

{ “询问”: { “请求参数”: { “查询”:“新” } }, “来自”:0, “尺寸”:10 }

谁能告诉我“这里出现了什么问题以及为什么会出现”这对我解决这个问题会更有帮助

【问题讨论】:

  • 您如何发送查询以及使用哪个客户端?
  • @Val 感谢您的回复。我已在弹性搜索头插件中检查过此查询。
  • 那么在有效载荷中发送查询时,您必须使用 POST 方法而不是 GET。请重试。
  • @val 但用于搜索 API 的 get 方法对吗? .我不明白为什么我们使用 post 方法进行搜索
  • GET 只应在不发送任何有效负载时使用,否则应使用 POST。 head 插件在使用 GET 时不会发送任何有效负载,因此只需 POST 即可。

标签: elasticsearch


【解决方案1】:

由于您在头插件中使用 GET 发送查询,因此它不会发送任何有效负载

因此,您应该只发布 POST 并且它会起作用。

只有在不发送任何有效负载且仅在 URL 中进行查询时才应使用 GET(即使用q=...,否则应使用 POST。

【讨论】:

  • 试试这个有什么好运气吗?
猜你喜欢
  • 1970-01-01
  • 2018-11-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多