Skip to content

Commit

Permalink
Set mappings of elastisearch to work with dini kim lrmi profile
Browse files Browse the repository at this point in the history
In JSON-LD an '@context' is used to define semantics of JSON fields. These
definitions can consist of an array with mixed data types. This is invalid
when tried to be indexed into elasticsearch. As a mapping of the index can be
defined to ignore the '@context' field for indexing such an JSON-LD document
can then be loaded into elasticsearch.

The mapping must be set when initializing the index. This is done in the
start script provided by skohub-pubsub.

See #40.
  • Loading branch information
dr0i authored and lod aither committed Oct 27, 2020
1 parent 56f9bb0 commit f9f8d5f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions scripts/elasticsearch-mappings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"mappings" : {
"_doc" : {
"properties" : {
"attachment" : {
"properties" : {
"@context" : {
"enabled" : false
}
}
}
}
}
}
}
4 changes: 2 additions & 2 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ cd $HOME/git/$NAME/scripts
###
# nothing to change from here
###
# ensure elasticsearch index exists
curl -XPUT $ES_NODE/skohub
# ensure elasticsearch index exists and initialize proper mappings
curl -XPUT $ES_NODE/skohub -H 'Content-Type: application/json' -d "@elasticsearch-mappings.json"

npm install
# start skohub-pubsub
Expand Down

0 comments on commit f9f8d5f

Please sign in to comment.