简体   繁体   English

elasticsearch size参数不起作用

[英]elasticsearch size parameter not work

With size parameter or not this query always return 10 document(total doc:12678) Somehow it ignores size parameter, even size eqauls to 2 it returns 10 docs again 使用size参数或不使用此查询总是返回10个文档(总文档:12678)它以某种方式忽略大小参数,甚至大小eqauls为2它再次返回10个文档

POST webproxylog/_search
    {
      "from": 0, "size": 100, 
      "query": {
        "filtered": {
          "filter": {
             "terms": {
                "category": [

                  "-1",
                  "0"
                ]
              }
          }
        }
      },
      "sort": [
        {
          "respsize": {
            "order": "desc"
          }
        }
      ]
    }

You should use POST instead of GET when sending the query in the HTTP payload. 在HTTP有效负载中发送查询时,应使用POST而不是GET。 Some HTTP clients do not send a payload when using GET. 某些HTTP客户端在使用GET时不发送有效负载。

The following will get you 100 results: 以下将获得100个结果:

curl -XPOST localhost:9200/webproxylog/_search -d '{
      "from": 0, "size": 100, 
      "query": {
        "filtered": {
          "filter": {
             "terms": {
                "category": [

                  "-1",
                  "0"
                ]
              }
          }
        }
      },
      "sort": [
        {
          "respsize": {
            "order": "desc"
          }
        }
      ]
    }'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM