Commit 050e153e authored by Tobinsk's avatar Tobinsk
Browse files

Merge branch '2-fail-to-resolve' into 'master'

Update elastic search client and adapt new mappings of the results

Closes #2

See merge request !4
parents 93c8b336 d0ce5116
......@@ -10,9 +10,9 @@
"integrity": "sha512-FhlMa34NHp9K5MY1Uz8yb+ZvuX0pnvn3jScRSNAb75KHGB8d3rEU6hqMs3Z2vjuytcMfRg6c5CHMc3wtYyD2/A=="
},
"@types/elasticsearch": {
"version": "5.0.26",
"resolved": "https://registry.npmjs.org/@types/elasticsearch/-/elasticsearch-5.0.26.tgz",
"integrity": "sha512-SyNqeVTxWmegueOAYoTD9RahSIwBAAB6Lcuh4ZsYCidrtvP+cIuIMRLXFhmirB7sLkkWqQNWtt/GofEz96gi3Q==",
"version": "5.0.36",
"resolved": "https://registry.npmjs.org/@types/elasticsearch/-/elasticsearch-5.0.36.tgz",
"integrity": "sha512-uV1mcrQIscL1HuewQ4XoEmv64tIBP/fN6u+LfBJEzO6DfXLZeogmP6odybxzFDg0C85/e102++3XKV68lYScLQ==",
"dev": true
},
"@types/es6-promise": {
......@@ -67,9 +67,9 @@
}
},
"agentkeepalive": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-3.5.1.tgz",
"integrity": "sha512-Cte/sTY9/XcygXjJ0q58v//SnEQ7ViWExKyJpLJlLqomDbQyMLh6Is4KuWJ/wmxzhiwkGRple7Gqv1zf6Syz5w==",
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-3.5.2.tgz",
"integrity": "sha512-e0L/HNe6qkQ7H19kTlRRqUibEAwDK5AFk6y3PtMsuut2VAH6+Q4xZml1tNDJD7kSAyqmbG/K08K5WEJYtUrSlQ==",
"requires": {
"humanize-ms": "^1.2.1"
}
......@@ -477,9 +477,9 @@
}
},
"elasticsearch": {
"version": "15.1.1",
"resolved": "https://registry.npmjs.org/elasticsearch/-/elasticsearch-15.1.1.tgz",
"integrity": "sha512-Yr9xy10rUMjDty7qCys7X9AIW5+PX4Gtv2NksZqXIc+AZiWna/y2QwZdiSLtb5LTOKDp7PbegfuokhIjMHUpKw==",
"version": "16.5.0",
"resolved": "https://registry.npmjs.org/elasticsearch/-/elasticsearch-16.5.0.tgz",
"integrity": "sha512-9YbmU2AtM/kQdmp96EI5nu2bjxowdarV6IsKmcS+jQowJ3mhG98J1DCVOtEKuFvsnNaLyKD3aPbCAmb72+WX3w==",
"requires": {
"agentkeepalive": "^3.4.1",
"chalk": "^1.0.0",
......@@ -498,7 +498,7 @@
},
"chalk": {
"version": "1.1.3",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"requires": {
"ansi-styles": "^2.2.1",
......@@ -517,9 +517,9 @@
}
},
"lodash": {
"version": "4.17.10",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
"integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg=="
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
},
"strip-ansi": {
"version": "3.0.1",
......
......@@ -5,14 +5,14 @@
"main": "dist/index.js",
"dependencies": {
"concurrently": "^3.5.1",
"elasticsearch": "^15.1.1",
"elasticsearch": "^16.5",
"geolinker-common": "git+https://gitlab+deploy-token-1:vnsdCm_t84QGVA2U4kw4@source.dodis.ch/histhub/geolinker-common.git",
"nconf": "^0.10.0",
"request": "^2.87.0",
"typescript": "^2.8.4"
},
"devDependencies": {
"@types/elasticsearch": "^5.0.26",
"@types/elasticsearch": "^5.0.36",
"@types/nconf": "0.0.37",
"@types/node": "^9.6.19",
"@types/winston": "^2.3.9",
......@@ -24,7 +24,7 @@
"lint": "node_modules/.bin/tslint -c tslint.json 'src/**/*.ts'",
"build": "node_modules/.bin/tsc",
"watch": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run watch-node\"",
"watch-node": "nodemon dist/linker-consumer.js",
"watch-node": "nodemon dist/index.js",
"watch-ts": "tsc -w"
},
"author": "",
......
......@@ -12,5 +12,6 @@ export function createClient(nconf: Provider): Client {
hosts: [
`${nconf.get('elasticsearch:server')}:${nconf.get('elasticsearch:port')}/`,
],
apiVersion: '7.2',
});
}
......@@ -43,7 +43,9 @@ class ElasticSearchTransformer extends Transform {
const result: SearchResponse<any> = await this.client.search(query);
// get links or empty array
if (result.hits.total !== 0) {
// hack because of wrong definitions ins typescript
const total: any = result.hits.total;
if (total.value !== 0) {
links = result.hits.hits.map((hit) => {
return hit._source.url;
});
......@@ -87,7 +89,8 @@ class ElasticSearchTransformer extends Transform {
},
});
if (baseEntity.hits.total === 0) {
const total: any = baseEntity.hits.total;
if (total.value === 0) {
return false;
}
......
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