When I write this query in kibana console, it shows me correct output.
I copy the curl command from kibana then run it in Ubuntu terminal but nothing works.
I am using this curl command
curl -XPOST "http://localhost:9200/_sql?format=json" -H 'Content-
Type: application/json' -d'{ "query": "select * from abusix_1 where
Date between \"2019-07-29T08:00:45.000Z\" and \"2019-08-
29T08:00:45.000Z\""}'
and it shows me this output
{"error":{"root_cause":
[{"type":"verification_exception","reason":"Found 3 problem(s)\nline
1:30: Unknown column [Date], did you mean [path]?\nline 1:43:
Unknown column [2019-07-29T08:00:45.000Z]\nline 1:74: Unknown column
[2019-08-
29T08:00:45.000Z]"}],"type":"verification_exception","reason":"Found
3 problem(s)\nline 1:30: Unknown column [Date], did you mean [path]?
\nline 1:43: Unknown column [2019-07-29T08:00:45.000Z]\nline 1:74:
Unknown column [2019-08-29T08:00:45.000Z]"},"status":400}
I have tried these things
1) I have changed double quotation to single quotation without forward slash.
2)I have changed "query" to \"query\"
3)I have changed Date column to Date_Created
But nothing works.So what is the issue and how can I solve it?
It should be work like this
curl -XPOST "http://localhost:9200/_sql?format=json" -H 'Content-Type:
application/json' -d "{\"query\": \"select * from abusix_1 where Date between
'2019-07-29T08:00:45.000Z' and '2019-08-29T08:00:45.000Z'\"}"
Related
I was trying to import dashboard using exported json file from one server to another server of grafana, but getting bellow error;
{"message":"Dashboard not found","status":"not-found"}
My curl command:
curl -X POST --insecure -H "Authorization: Bearer {API KEY}" -H "Content-Type: application/json" --data-binary #'{JSON file name}' http://{Host ip}:3000/api/dashboards/db
To export dashboard, I am using following curl command;
curl -f -k -H "Authorization: Bearer {API key}" "http://{Host IP}:3000/api/dashboards/db/mydashboard" | jq 'del(.overwrite,.dashboard.version,.meta.created,.meta.createdBy,.meta.updated,.meta.updatedBy,.meta.expires,.meta.version)' > {JSON file name}"
I am unable to find exact missing field OR value which is missing OR incorrectly passed through JSON file while importing. Is there any way to debug?
Is there any issue with my Export and import command.
As mentioned in this issue,
you must replace the "id": num field of the dashboard with null.
so you can change it for all of your dashboards (.json files) by command below: (works with GNU sed only)
sed -i '0,/"id": .*/{s/"id": .*/"id": null,/}' *.json
The simplest solution is to set the 'id' from root of the json to null.
"id": null,
Be aware, it's not the same field as uid in the end of the json (also root). That one must be unique, but not null.
My pc is windows 10. I want to use curl command to get the data from elasticsearch, but I have some problems.
this is my curl command (a small test):
curl "http://localhost:9200/_search" -d '{"query": {"match_all": {}}}'
and the cmd show the error:
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}curl: (3) [globbing] unmatched brace in column 1
curl: (3) [globbing] empty string within braces in column 2
could anyone help me?
thank you in advance.
It seems like you need to provide the proper Content-Type header as well:
curl -H "Content-Type: application/json" -d '{"query": {"match_all": {}}}' "http://localhost:9200/_search"
There are many examples of using cUrl with Neo4j to execute queries but i cannot get it working.
E.g.: https://neo4j.com/blog/export-csv-from-neo4j-curl-cypher-jq/
OS: Windows
DB: Neo4j comunity 3.1.1
cUrl: 7.53.1
"D:\Programme\Tools\curl\curl.exe" -H "Content-Type: application/json" -d '{"statements":[{"statement":
"match (n) return count(n)"}]}' http://localhost:7474/db/data/transaction/commit
Result:
{"results":[],"errors":[{"code":"Neo.ClientError.Request.InvalidFormat","message":"Unable to deserialize request: Unexpe
cted character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [
Source: HttpInputOverHTTP#18463df6; line: 1, column: 2]"}]}
Probably because you are not passing the username and password of the database within the URL. Try this, it worked on mine:
curl -X POST -H 'Content-type: application/json' http://DB_USERNAME:DB_PASSWORD#localhost:7474/db/data/transaction/commit -d '{"statements": [{"statement": "MATCH (n) RETURN n;"}]}'
I need some help with my perl script.
I am new to perl and using curl and despite a lot of searching/ trial and error I am still stumped.
I am trying to use CURL to retrieve a set of jira issues based on the provided JQL.
Unfortunately I am having issues with spaces when I search fields like summary:
my $jql = JiraUrl.'search?jql=summary~"Some%20Silly%20Issue"';
When I curl this...
my $jsonResponse = `curl -D- -u $user:$password -X GET -H "Content-Type: application/json" $jql`;
I get an error ..
{"errorMessages":["Error in the JQL Query: Expecting either \'OR\' or \'AND\' but got \'Silly\'. (line 1, character 77)"],"errors":{}}';
Basicly when I escape the " " with %20 it ignores the "'s
Any help for how to get around this?
It looks like it's a shell escaping issue. The quotes are being interpreted by the shell. Try this:
my $jsonResponse = `curl -D- -u $user:$password -X GET -H "Content-Type: application/json" '$jql'`;
I'm writing unit tests for an ElasticSearch datasource, however, I am getting mixed results. The problem is that a match_all query isn't finding records that I submitted, however, when I run the commands by hand using CURL in the same order the unit test does I am able to find the records.
I believe that perhaps the index isn't refreshed, so, I started running the "refresh" api command after submitting records, however, this didn't work either. Here is my list of commands - it would be helpful if anyone had any suggestions on how to make sure these commands worked even if they were run in immediate succession.
Commands the unit test runs:
curl -XGET 'http://localhost:9200/test_index/_mapping'
curl -XDELETE 'http://localhost:9200/test_index/test_models'
curl -XPOST 'http://localhost:9200/test_index/test_models/_refresh' -d '{}'
curl -XPUT 'http://localhost:9200/test_index/test_models/_mapping' -d '{"test_models":{"properties":{"TestModel":{"properties":{"id":{"type":"string","index":"not_analyzed"},"string":{"type":"string"},"created":{"type":"date","format":"yyyy-MM-dd HH:mm:ss"},"modified":{"type":"date","format":"yyyy-MM-dd HH:mm:ss"}},"type":"object"}}}}'
curl -XPOST 'http://localhost:9200/test_index/test_models/_bulk' -d '{"index":{"_index":"test_index","_type":"test_models","_id":"test-model"}}
{"TestModel":{"id":"test-model","string":"Analyzed for terms","created":"2012-01-01 00:00:00","modified":"2012-02-01 00:00:00"}}
'
curl -XPOST 'http://localhost:9200/test_index/test_models/_refresh' -d '{}'
curl -XGET 'http://localhost:9200/test_index/_mapping'
curl -XGET 'http://localhost:9200/test_index/test_models/_search' -d '{"query":{"match_all":{}},"size":10}'
This question has also been posted to the (super awesome) ElasticSearch mailing list:
https://groups.google.com/forum/?fromgroups#!topic/elasticsearch/Nxv0XpLDY4k
-DK
The problem is with the _refresh command.
You can't refresh a type, only an index. I changed the refresh command to:
curl -XPOST 'http://localhost:9200/test_index/_refresh'
And it is now fixed!