Skip to content

Instantly share code, notes, and snippets.

@VerosK
Created October 19, 2021 07:07
Show Gist options
  • Save VerosK/be8db9a71b9fd59f8a710fc010759f70 to your computer and use it in GitHub Desktop.
Save VerosK/be8db9a71b9fd59f8a710fc010759f70 to your computer and use it in GitHub Desktop.
JSON - demo
{
"name" : "John",
"lastname" : "Smith",
"job_description" : "Accountant"
}
{
"name" : "John",
"lastname" : "Doe",
"job_description" : "Systems administrator and Linux specialist"
}
# legacy
#curl -XPOST localhost:9200/people/person/1 -H "Content-Type: application/json" --data-binary '@john.json'
curl -XPUT localhost:9200/people/_doc/1 -H "Content-Type: application/json" --data-binary '@john.json'
# legacy
#curl -XPOST localhost:9200/people/person/ -H "Content-Type: application/json" --data-binary '@john-smith.json'
curl -XPOST localhost:9200/people/_doc/ -H "Content-Type: application/json" --data-binary '@john-smith.json'
# legacy
# curl -XGET localhost:9200/people/person/
curl -XGET localhost:9200/people/_doc/1
# check it exists
curl -XHEAD localhost:9200/people/_doc/1
# check only source data
curl -XGET localhost:9200/people/_source/1
# _search - Lucene QL
curl -XGET localhost:9200/people/_search?q=john
# _search - Lucene QL
curl -XGET localhost:9200/people/_search?q=job_description:john
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment