我想在特定日期范围内从elasticsearch获取记录。我试过以下查询 -
curl -X GET "http://localhost:9200/150/_search?pretty" -H "Content-Type:application/json" -d "{\"query\":{\"range\":{\"timestamp\":{\"gte\":\"16/Jan/2019\",\"lte\":\"18/Jan/2019\",\"boost\":2.0}}}}"
但在这里我得到了所有的文件。有谁可以帮我解决这个问题?先感谢您。
您需要使用以下日期格式:yyyy-MM-dd
。试试这个:
curl -X GET "http://localhost:9200/150/_search?pretty" -H "Content-Type:application/json" -d "{\"query\":{\"range\":{\"timestamp\":{\"gte\":\"2019-01-16\",\"lte\":\"2019-01-18\",\"boost\":2.0}}}}"