elastic-query-export
elastic-query-export copied to clipboard
issue with raw query
I've tried the following windows command : elastic-query-export.exe -c "http://localhost:9200" -i "myindex-*" --start="2022-09-27T00:00:00" --fields="foo,bar" -r '{"bool":{"filter":{"bool":{"must":[{"range":{"date":{"from":"2022-09-27T00:00:00.000","include_lower":true,"include_upper":false,"time_zone":"+02:00","to":"2022-09-28T12:20:00.000"}}}]}}}}' -f "csv" -o "test_export_es.csv"
and got this error in return Error counting ElasticSearch documents - invalid character '\'' looking for beginning of value invalid character '\'' looking for beginning of value
I tried it several times with the same query you provided and it worked all the time. It's also not fully clear if the errors comes from your query input or from the response of the Elasticsearch server. It looks like maybe the shell adds some additional escaping (because of the in ).
Thanks @pteich for making this great tool. I am just wondering how I can use the size: and sort: with the raw query. In my tests, it could not work with -r '{"size":1,"sort":[{"@timestamp":{"order":"desc"}}],"query":{"bool":{"must":[{"query_string":{"query":"tags:test}}],"filter":[{"range":{"@timestamp":{"from":"2023-04-22T00:00:00.000"}}}]}}}'
but it can work well without size
and sort
. Do you know how I can make it working with size and sort? Thank you!