Skip to content
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
Closed

Default limit value is not applied on searches #1775

edmundoa opened this issue Feb 5, 2016 · 3 comments
Assignees
Labels
bug
Milestone

Comments

@edmundoa
Copy link
Member

@edmundoa 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
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
 - 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
Copy link
Member

@kroepke kroepke commented Feb 11, 2016

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

@joschi
Copy link
Contributor

@joschi joschi commented Feb 11, 2016

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

@kroepke
Copy link
Member

@kroepke 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants