Skip to content

Instantly share code, notes, and snippets.

@rdmpage rdmpage/jsonld.sh forked from jprante/jsonld.sh
Created Apr 18, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.