【发布时间】:2019-12-28 00:10:23
【问题描述】:
client = Elasticsearch([host1, host2], http_auth=(user, password), scheme="http", port=port)
response = client.search(index="complats*", body={"from": 0, "size": 10000, "query": {
"bool": {
"must": [
{
"query_string": {
"query": "tags:\"prod\" AND severity:\"INFO\" AND service:\"abc-service\" AND msg:\"* is processed\"",
"fields": [],
"type": "best_fields",
"default_operator": "or",
"max_determinized_states": 10000,
"enable_position_increments": "true",
"fuzziness": "AUTO",
"fuzzy_prefix_length": 0,
"fuzzy_max_expansions": 50,
"phrase_slop": 0,
"escape": "false",
"auto_generate_synonyms_phrase_query": "true",
"fuzzy_transpositions": "true",
"boost": 1.0
}
},
{
"range": {
"@timestamp": {
"from": "now-{}s".format((now.minute + 1) * 60),
"to": "now",
"include_lower": "true",
"include_upper": "true",
"boost": 1.0
}
}
}
],
"adjust_pure_negative": "true",
"boost": 1.0
}
}})
value = response['hits']['total']['value']
print(value)
上述查询成功连接到elasticsearch,但每次都返回错误的值或10000。这里有什么问题?我在某处读过python中的elasticsearch模块有一个错误,它的最大值为10000。还有其他人遇到过这个问题吗?如果是,你是如何解决的? 提前致谢!
【问题讨论】:
-
更改“max_determinized_states”:10000 没有帮助,它仍然返回相同的值。
标签: python elasticsearch kibana