Permalink
Browse files

Fixed resultset bug

  • Loading branch information...
1 parent c57eb39 commit 7acdd1b06cc8510796966114da10fa4521bac3f7 Alberto Paro committed Aug 23, 2012
Showing with 26 additions and 1 deletion.
  1. +0 −1 pyes/es.py
  2. +26 −0 scripts/test_200.py
View
@@ -1873,5 +1873,4 @@ def __iter__(self):
self._results = None
self._current_item = 0
- self.start = 0
return self
View
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import pyes
+
+index = "test2"
+doc_type = "test"
+
+es = pyes.ES(["http://127.0.0.1:9200"])
+
+es.create_index_if_missing(index)
+for i in range(1, 100):
+ es.index({"number":i}, index=index, doc_type=doc_type)
+
+es.refresh([index])
+
+query = pyes.StringQuery("*")
+search = pyes.query.Search(query=query, start=0, size=10, sort=[{"number":"asc"}], fields=["number"])
+results = es.search(search, indices=[index], doc_types=[doc_type])
+print [i for i in results]
+
+query2 = pyes.StringQuery("*")
+search2 = pyes.query.Search(query=query2, start=20, size=20, sort=[{"number":"asc"}], fields=["number"])
+results2 = es.search(search2, indices=[index], doc_types=[doc_type])
+print [i for i in results2]
+
+es.delete_index_if_exists(index)

0 comments on commit 7acdd1b

Please sign in to comment.