python - Cloudsearch Request Exceed 10,000 Limit -
when search query has more 10,000 matches following error:
{u'message': u'request depth (10100) exceeded, limit=10000', u'__type': u'#searchexception', u'error': {u'rid': u'zpxdxukp4befcigqeq==', u'message': u'[*deprecated*: use outer message field] request depth (10100) exceeded, limit=10000'}}
when search more narrowed down keywords , queries less results, works fine , no error returned.
i guess have limit search somehow, i'm unable figure out how. search function looks this:
def execute_query_string(self, query_string): amazon_query = self.search_connection.build_query(q=query_string, start=0, size=100) json_search_results = [] json_blog in self.search_connection.get_all_hits(amazon_query): json_search_results.append(json_blog) results = [] json_blog in json_search_results: results.append(json_blog['fields']) return results
and it's being called this:
results = searcher.execute_query_string(request.get.get('q', ''))[:100]
as can see, i've tried limit results start
, size
attributes of build_query()
. still error though.
i must have missunderstood how avoid getting more 10,000 matches on search result. can tell me how it?
all can find on topic amazon's limits says can request 10,000 results. not how limit it.
you're calling get_all_hits
, gets results query. why size
param being ignored.
from docs:
get_all_hits(query) generator iterate on search results
transparently handles results paging cloudsearch search results if have many thousands of results can iterate on results in reasonably efficient manner.
you should calling search
instead -- http://boto.readthedocs.org/en/latest/ref/cloudsearch2.html#boto.cloudsearch2.search.searchconnection.search
Comments
Post a Comment