New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default limit value is not applied on searches #1775

Closed
edmundoa opened this Issue Feb 5, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@edmundoa
Member

edmundoa commented Feb 5, 2016

Using the current master, the default limit parameter for searches is not working. Here's the result of the query http://hostname:12900/search/universal/relative?query=*&range=3600&pretty=true:

{
  "query" : "*",
  "built_query" : "{\"from\":0,\"query\":{\"bool\":{\"must\":{\"match_all\":{}},\"filter\":{\"bool\":{\"must\":{\"range\":{\"timestamp\":{\"from\":\"2016-02-05 17:25:44.854\",\"to\":\"2016-02-05 18:25:44.854\",\"include_lower\":true,\"include_upper\":true}}}}}}},\"sort\":[{\"timestamp\":{\"order\":\"desc\"}}],\"highlight\":{\"require_field_match\":false,\"fields\":{\"*\":{\"fragment_size\":0,\"number_of_fragments\":0}}}}",
  "used_indices" : [ {
    "index_name" : "graylog2_19",
    "begin" : "1970-01-01T00:00:00.000Z",
    "end" : "1970-01-01T00:00:00.000Z",
    "calculated_at" : "2016-02-05T13:28:28.379Z",
    "took_ms" : 9
  }, {
    "index_name" : "graylog2_5",
    "begin" : "2015-12-17T10:34:30.794Z",
    "end" : "2016-12-17T17:26:41.000Z",
    "calculated_at" : "2016-01-26T14:11:56.019Z",
    "took_ms" : 13
  } ],
  "messages" : [ {
    "message" : {},
    "index" : "graylog2_19",
    "highlight_ranges" : null
  }, {
    "message" : {},
    "index" : "graylog2_19",
    "highlight_ranges" : null
  }, {
    "message" : {},
    "index" : "graylog2_19",
    "highlight_ranges" : null
  }, {
    "message" : {},
    "index" : "graylog2_19",
    "highlight_ranges" : null
  }, {
    "message" : {},
    "index" : "graylog2_19",
    "highlight_ranges" : null
  }, {
    "message" : {},
    "index" : "graylog2_19",
    "highlight_ranges" : null
  }, {
    "message" : {},
    "index" : "graylog2_19",
    "highlight_ranges" : null
  }, {
    "message" : {},
    "index" : "graylog2_19",
    "highlight_ranges" : null
  }, {
    "message" : {},
    "index" : "graylog2_19",
    "highlight_ranges" : null
  }, {
    "message" : {},
    "index" : "graylog2_19",
    "highlight_ranges" : null
  } ],
  "fields" : [],
  "time" : 6,
  "total_results" : 23914,
  "from" : "2016-02-05T17:25:44.861Z",
  "to" : "2016-02-05T18:25:44.861Z"
}

As you can see, the search is returning 10 results instead of 150. Looking a bit through the code, I saw that the limit applied in SearchesConfig.Builder is overrode by setting a 0 limit afterwards, and that is happening in some places where we rely on the default limit.

@edmundoa edmundoa added the bug label Feb 5, 2016

@edmundoa edmundoa added this to the 2.0.0 milestone Feb 5, 2016

kroepke added a commit that referenced this issue Feb 10, 2016

fix wrong default of limit search parameter
the builder didn't properly default a 0 value to the actual default

fixes issue #1775

kroepke added a commit that referenced this issue Feb 10, 2016

also guard against negative limit
 - add test for negative limit
 - actually test the explicit limit as well (so it doesn't get overridden by the default handling)

fixes issue #1775

@joschi joschi closed this Feb 11, 2016

@kroepke

This comment has been minimized.

Member

kroepke commented Feb 11, 2016

hm, why isn't this issue fixed? the PR seems to be merged? @edmundoa @joschi ?

@joschi

This comment has been minimized.

Contributor

joschi commented Feb 11, 2016

@kroepke The "magic keywords" in a2e03da were wrong ("Fixes issue #1775" instead of "Fixes #1775").

@kroepke

This comment has been minimized.

Member

kroepke commented Feb 11, 2016

ah duh :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment