CDB3-7266 Додати валідацію дати
В эластике есть ограничение, дата должна быть больше 1970 года
date[1969-12-31T23:59:00Z] is before the epoch in 1970 and cannot be stored in nanosecond resolution
https://procedure-dev.prozorro.sale/api/search/bySystemDateModified/1969-10-24T14:04:56.108000Z
[2024-04-16T15:25:00.737Z] | prozorro_sale.search.es.base | ERROR - Fail elastic query {"size":100,"sort":[{"dateModified":"asc"}],"track_total_hits":10000,"query":{"range":{"dateModified":{"gte":"1969-12-31T23:59:00+00:00","lte":"2024-04-16T15:24:58.728453"}}}} | X-Request-ID: 4A53D7F000001C7827F0000010050661E984C2965A20D2
Traceback (most recent call last):
File "/search/prozorro_sale/search/es/base.py", line 241, in search_by_query
result = await self.__client.search(
File "/usr/local/lib/python3.9/site-packages/elasticsearch/_async/client/__init__.py", line 1833, in search
return await self.transport.perform_request(
File "/usr/local/lib/python3.9/site-packages/elasticsearch/_async/transport.py", line 427, in perform_request
raise e
File "/usr/local/lib/python3.9/site-packages/elasticsearch/_async/transport.py", line 389, in perform_request
status, headers_response, data = await connection.perform_request(
File "/usr/local/lib/python3.9/site-packages/elasticsearch/_async/http_aiohttp.py", line 357, in perform_request
self._raise_error(response.status, raw_data)
File "/usr/local/lib/python3.9/site-packages/elasticsearch/connection/base.py", line 328, in _raise_error
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(
elasticsearch.exceptions.RequestError: RequestError(400, 'search_phase_execution_exception', 'date[1969-12-31T23:59:00Z] is before the epoch in 1970 and cannot be stored in nanosecond resolution')
надо выводить коректную ошибку, что дата должна быть больше 1970 года
Edited by Olga Kochubynska