这是我的代码:
qs_pk = Vacancy.objects.values_list('pk', flat=True)
sqs = SearchQuerySet().models(Vacancy)
sqs = sqs.filter(id__in=qs_pk)
当我尝试使用sqs.count()
方法时,我得到一个例外:
elasticsearch.exceptions.RequestError:TransportError(400,'search_phase_execution_exception','无法解析查询[id :(“281134”或“281135”或“272222”或“287848”或“190255”或“266921”或“235700”或“235683”或“281138”或“281144”或“186683”或“281145”或“281147”或“244712”................
但如果我限制qs_pk = qs_pk[:1024]
那么它就没事了。
我在elasticsearch
日志中发现了一些东西:
Caused by: org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 1024
也许需要编辑一些elasticsearch.yml
的值