diff --git a/dashboard/src/app/els.service.ts b/dashboard/src/app/els.service.ts index 1886bb6..1875a7d 100644 --- a/dashboard/src/app/els.service.ts +++ b/dashboard/src/app/els.service.ts @@ -118,7 +118,8 @@ export class ElsService { console.debug("getArtistSongs- Artist name: " + artistName + " - from: " + from); return this.http .post(this.elsUrl + "song/_search", - JSON.stringify({ + JSON.stringify( + { "query": { "bool": { "should": [ @@ -129,7 +130,7 @@ export class ElsService { }, "size": ElsService.DEFAULT_SIZE, "from": from - }), + }), {headers: this.headers}) .map(res => { return res.json().hits.hits; @@ -157,7 +158,7 @@ export class ElsService { return undefined; } if (hits.length > 1) { - console.error('More than one album "' + albumName + '" found, return the first.'); + console.error('More than one album "' + albumName + '" found (' + hits.length + '), return the first.'); } return hits[0]._source; }); @@ -172,12 +173,13 @@ export class ElsService { .map((hits: Array) => { // Theorically, my script prevent to found two documents with this query. // But Prevention is better than cure as Shakespeare said + console.log(hits.length); if (hits.length < 1) { console.info('No artist "' + artistName + '" found.'); return undefined; } if (hits.length > 1) { - console.error('More than one artist "' + artistName + '" found, return the first.'); + console.error('More than one artist "' + artistName + '" found (' + hits.length + '), return the first.'); console.error('This is not normal!') } return hits[0]._source;