我正在尝试将今天的日期插入我的curl命令,但我无法获取date命令来显示正确的日期。
(process:44516): Gdk-WARNING **: locale not supported by C library
(process:44516): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
(dia-bin:44516): Gtk-WARNING **: cannot open display: :0
我试过了:
root@elk01:~# curl -s -XGET 'http://localhost:9200/"$(date -u +%Y.%m.%d)"/_search?pretty'
{
"error":
{"root_cause":
[
{"type":"illegal_argument_exception","reason" : "invalid version format: -U +%Y.%M.%D)\"/_SEARCH?PRETTY HTTP/1.1"}
],
"type":"illegal_argument_exception","reason":"invalid version format: -U +%Y.%M.%D)\"/_SEARCH?PRETTY HTTP/1.1"
},
"status":400
}
但它们实际上都没有使用curl -s -XGET 'http://localhost:9200/"$(date -u +%Y.%m.%d)"/_search?pretty'
curl -s -XGET 'http://localhost:9200/\"$(date -u +%Y.%m.%d)\"/_search?prett
y'
curl -s -XGET "http://localhost:9200/\$(date -u +%Y.%m.%d)/_search?prett
y"
的结果。
答案 0 :(得分:1)
以下命令为我完成了这项工作:
curl -XGET "http://localhost:9200/`date -u +%Y.%m.%d`/_search" -d '
{
"query": {
"match_all": {}
}
}'