Reputation: 280
I have elasticsearch curl command which I have placed in one shell script as follows:
#!/bin/bash
totalCount=`curl -XGET 'http://localhost:9200/_all/_count?pretty=true' -d '{
"query" : {
"bool" : {
"must" : [
{
"match" : {
"type" : "mtaLogs"
}} ,
{
"filtered" : {
"filter" : {
"range" : {
"@timestamp" : {
"from" : "2015-07-27T00:00:01",
"to" : "2015-07-27T23:59:59"
}
}
}
}
}
]
}
}
}' | jq '.count'`
echo "Total mtaLogs count is $totalCount"
Now it is supposed to show output only as Total mtaLogs count is <some count>
But it is showing output as
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 98 0 98 0 755 7572 58337 --:--:-- --:--:-- --:--:-- 0
Total mtaLogs count is 39
Why am I getting this unnecessary table output on console?
Any help here?
Upvotes: 0
Views: 1466
Reputation: 217554
You simply need to add the -s
or -silent
switch to the curl command and it will be executed silently without the verbose table, i.e.
totalCount=`curl -s -XGET 'http://localhost:9200/_all/_count?pretty=true' -d '{
^
|
|
HERE
Upvotes: 2