Commit da3e3fda authored by J. Fernando Sánchez's avatar J. Fernando Sánchez
Browse files

Add examples, and es to docker-compose

parent 96d10d4e
......@@ -13,3 +13,4 @@ elasticsearch
/fuseki/*
dashboard-reddit.html
*.pem
demo/index.html
\ No newline at end of file
......@@ -202,7 +202,7 @@
</div>
<div>
<yasgui-ui
endpoint="http:///sefarad-fuseki.cluster.gsi.dit.upm.es/gsicrawler/query"
endpoint="http:////gsicrawler/query"
</yasgui-ui>
</div>
</iron-pages>
......@@ -334,7 +334,7 @@
// undocumented params are appended to the query string
index: "gsicrawler",
body: {
size: 22,
size: 200,
query: {
multi_match:{
query: this.query,
......@@ -421,7 +421,7 @@
// undocumented params are appended to the query string
index: "gsicrawler",
body: {
size: 22,
size: 200,
query: {
bool: {
must: this.filters,
......
<html>
<head>
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="imports.html"></link>
<link href='//cdn.jsdelivr.net/yasqe/2.6.2/yasqe.min.css' rel='stylesheet' type='text/css'/>
<link href='//cdn.jsdelivr.net/yasr/2.6.1/yasr.min.css' rel='stylesheet' type='text/css'/>
<script src='//cdn.jsdelivr.net/yasqe/2.6.2/yasqe.bundled.min.js'></script>
<script src='//cdn.jsdelivr.net/yasr/2.6.1/yasr.bundled.min.js'></script>
<style>
.info-box-icon.number-chart iron-icon.number-chart {
top: 26%;
}
</style>
</head>
<body>
<template is="dom-bind">
<elastic-client
config='{"host": "sefarad-elasticsearch.cluster.gsi.dit.upm.es"}'
client="{{client}}"
cluster-status="{{myStatus}}">
</elastic-client>
<dashboard-gsicrawler
client="{{client}}"></dashboard-gsicrawler>
<!-- <button id="databutton" onclick="changedata()">Click to change data</button> -->
<script>
var datas =[
{"hits": {
"total": 20000
},
"aggregations": {
"category": {
"buckets": [
{"key": "myObject", "doc_count": 3000},
{"key": "otherObject", "doc_count": 1000}
]
}
}
},
{"hits": {
"total": 30000
},
"aggregations": {
"category": {
"buckets": [
{"key": "myObject", "doc_count": 1000},
{"key": "otherObject", "doc_count": 4000}
]
}
}
}];
var numdata = 0;
<!-- var nc1 = document.getElementById('demo-chart1'); -->
<!-- var nc2 = document.getElementById('demo-chart2'); -->
<!-- nc1.data = nc2.data = datas[0]; -->
<!-- function changedata(){ -->
<!-- numdata += 1; -->
<!-- nc1.data = nc2.data = datas[numdata%2]; -->
<!-- } -->
</script>
</template>
</body>
</html>
version: '2'
version: '3'
services:
sefarad:
......@@ -9,8 +9,20 @@ services:
volumes:
- .:/usr/src/app
environment:
- ES_ENDPOINT_EXTERNAL=${ES_ENDPOINT_EXTERNAL}
- FUSEKI_ENDPOINT_DASHBOARD=${FUSEKI_ENDPOINT_DASHBOARD}
- ES_ENDPOINT_EXTERNAL=${ES_ENDPOINT_EXTERNAL-localhost:9200}
- FUSEKI_ENDPOINT_EXTERNAL=${FUSEKI_ENDPOINT_EXTERNAL-localhost:9300}
networks:
- sefarad-network
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.4.0
environment:
- "discovery.type=single-node"
- "xpack.security.enabled=false"
- "http.cors.enabled=true"
- "http.cors.allow-origin=*"
ports:
- "9200:9200"
- "9300:9300"
networks:
- sefarad-network
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
# coding: utf-8
import os
import requests
ROOT = os.path.dirname(os.path.realpath(__file__))
ENDPOINT = os.environ.get('ES_ENDPOINT_EXTERNAL', 'localhost:9200')
INDEX = 'gsicrawler'
FILE='dump.jsonlines'
eid = 0
print('Loading {} to {}'.format(FILE, ENDPOINT))
with open(os.path.join(ROOT, FILE), 'r') as f:
for line in f:
url = 'http://{}/{}/news/{}/'.format(ENDPOINT, INDEX, eid)
resp = requests.put(url, headers={'Content-Type': 'application/json'}, data=line)
if resp.status_code != 200:
print('Error with request:', url)
print(resp.text)
eid += 1
print('Loaded: {} entries'.format(eid))
import json
f = open('gsicrawler.json')
j = json.load(f)
for i in j['hits']['hits']:
print(json.dumps(i['_source']))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment