Skip to content

Instantly share code, notes, and snippets.

@rdmpage
Forked from jprante/jsonld.sh
Created April 18, 2017 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdmpage/98ed549994e8794df3b86c3430803a40 to your computer and use it in GitHub Desktop.
Save rdmpage/98ed549994e8794df3b86c3430803a40 to your computer and use it in GitHub Desktop.
JSON-LD in Elasticsearch
curl -XDELETE 'localhost:9200/jsonld'
curl -XPOST 'localhost:9200/jsonld'
curl -XPUT 'localhost:9200/jsonld/doc/1' -d '
{
"@context":
{
"dc": "http://purl.org/dc/elements/1.1/",
"ex": "http://example.org/vocab#"
},
"@id": "http://example.org/library",
"@type": "ex:Library",
"ex:contains":
{
"@id": "http://example.org/library/the-republic",
"@type": "ex:Book",
"dc:creator": "Plato",
"dc:title": "The Republic",
"ex:contains":
{
"@id": "http://example.org/library/the-republic#introduction",
"@type": "ex:Chapter",
"dc:description": "An introductory chapter on The Republic.",
"dc:title": "The Introduction"
}
}
}
'
curl -XGET 'localhost:9200/_refresh'
curl -XPOST 'localhost:9200/jsonld/_search?pretty' -d '
{
"query": {
"match" : {
"dc:creator" : "Plato"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment