Skip to content

Working with JSON LD

Amandeep Singh edited this page May 6, 2015 · 22 revisions

Converting JSON-LD to One Object Per Line

Merging JSON-LD Files

Loading JSON-LD into Elastic Search

a. git clone https://github.com/usc-isi-i2/dig-elasticsearch.git

b. Change directory to types/webpage/scripts

c. Type python loadDataElasticSearch.py -h. This will provide help for the script as below

usage: loadDataElasticSearch.py [-h] [-hostname HOSTNAME] [-port PORT]
                                [-mappingFilePath MAPPINGFILEPATH] dataFileType
                             filepath indexname doctype

positional arguments:
   filepath            json file to be loaded in ElasticSearch
   indexname           desired name of the index in ElasticSearch
   doctype             type of the document to be indexed
   dataFileType        Specify '0' if every line in the data file is
                       different json object or '1' otherwise

optional arguments:
   -h, --help                       show this help message and exit
   -hostname HOSTNAME               Elastic Search Server hostname, defaults to 'localhost'
   -port PORT                       Elastic Search Server port,defaults to 9200
   -mappingFilePath MAPPINGFILEPATH mapping/setting file for the index

Execute:

python loadDataElasticSearch.py <filepath> <index-name> WebPage

If you don't have Elastic Search please download it from https://www.elastic.co/products/elasticsearch and follow the installation instructions.

Point to dig-elasticsearch