'Validation Failed: 1: [indices] cannot be used with point in time;'}]
'Validation Failed: 1: [indices] cannot be used with point in time;'}]
按照本指南 (https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html),我创建了一个 PIT ID 并使用该 ID 尝试使用以下查询对搜索结果进行分页:
start_date = '2020-03-11T00:00:00Z'
end_date = '2021-10-30T00:00:00Z'
start_date = datetime.datetime.strptime(start_date, "%Y-%m-%dT%H:%M:%SZ")
end_date = datetime.datetime.strptime(end_date, "%Y-%m-%dT%H:%M:%SZ")
search_param = {
"size": 10000,
"query": {
"bool": {
"must": [
{"range": {"ts": {"gte": start_date, "lt": end_date}}}
],
"should": [
{"exists": {"field": "data.test1"}},
{"exists": {"field": "data.test2"}},
{"exists": {"field": "data.test3"}}
],
"minimum_should_match": 1
}
},
"pit": {
"id": "0_uxAwILMTQxMV9ldmVudHMWTFhXQ3NrYWNSRDZMVlJzMlhPbjZVZwAWaEZZNUVOUF9SdTY5V0tMTzZyaEVtdwAAAAAAAA2Q6xZaeFkycDRKWVNxYXo0b252cXBLREtRCzE0MTFfZXZlbnRzFkxYV0Nza2FjUkQ2TFZSczJYT242VWcBFkMycTFXRmh2U3pDWXlPTXJtVlJUVWcAAAAAAAAs7BwWYmExNFdBNE9Sb1NNcklWNGgydURfUQEWTFhXQ3NrYWNSRDZMVlJzMlhPbjZVZwAA",
"keep_alive": "1m"
},
"sort": [
{"ts": "asc"}
]
}
然后我使用调用查询:
result = elastic_connector.search(index="data_store", body=search_param, ignore=[400, 404])
print('result' , result)
打印结果为:
result {'error': {'root_cause': [{'type': 'action_request_validation_exception', 'reason': 'Validation Failed: 1: [indices] cannot be used with point in time;'}], 'type': 'action_request_validation_exception', 'reason': 'Validation Failed: 1: [indices] cannot be used with point in time;'}, 'status': 400}
我正在使用 elasticsearch 7.11。这里有一个有点相关的问题:https://github.com/elastic/elasticsearch/issues/69974 但我不确定同样的问题是否适用于这里。
我应该如何构建接受 PIT 参数的查询?
按照本指南 (https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html),我创建了一个 PIT ID 并使用该 ID 尝试使用以下查询对搜索结果进行分页:
start_date = '2020-03-11T00:00:00Z'
end_date = '2021-10-30T00:00:00Z'
start_date = datetime.datetime.strptime(start_date, "%Y-%m-%dT%H:%M:%SZ")
end_date = datetime.datetime.strptime(end_date, "%Y-%m-%dT%H:%M:%SZ")
search_param = {
"size": 10000,
"query": {
"bool": {
"must": [
{"range": {"ts": {"gte": start_date, "lt": end_date}}}
],
"should": [
{"exists": {"field": "data.test1"}},
{"exists": {"field": "data.test2"}},
{"exists": {"field": "data.test3"}}
],
"minimum_should_match": 1
}
},
"pit": {
"id": "0_uxAwILMTQxMV9ldmVudHMWTFhXQ3NrYWNSRDZMVlJzMlhPbjZVZwAWaEZZNUVOUF9SdTY5V0tMTzZyaEVtdwAAAAAAAA2Q6xZaeFkycDRKWVNxYXo0b252cXBLREtRCzE0MTFfZXZlbnRzFkxYV0Nza2FjUkQ2TFZSczJYT242VWcBFkMycTFXRmh2U3pDWXlPTXJtVlJUVWcAAAAAAAAs7BwWYmExNFdBNE9Sb1NNcklWNGgydURfUQEWTFhXQ3NrYWNSRDZMVlJzMlhPbjZVZwAA",
"keep_alive": "1m"
},
"sort": [
{"ts": "asc"}
]
}
然后我使用调用查询:
result = elastic_connector.search(index="data_store", body=search_param, ignore=[400, 404])
print('result' , result)
打印结果为:
result {'error': {'root_cause': [{'type': 'action_request_validation_exception', 'reason': 'Validation Failed: 1: [indices] cannot be used with point in time;'}], 'type': 'action_request_validation_exception', 'reason': 'Validation Failed: 1: [indices] cannot be used with point in time;'}, 'status': 400}
我正在使用 elasticsearch 7.11。这里有一个有点相关的问题:https://github.com/elastic/elasticsearch/issues/69974 但我不确定同样的问题是否适用于这里。
我应该如何构建接受 PIT 参数的查询?