From 60bfc2cd2472e0d3d18144d71c96fd96728397ed Mon Sep 17 00:00:00 2001 From: Larisa Motova Date: Mon, 12 Dec 2016 20:22:23 -0500 Subject: [PATCH] got rid of unneccessary results in histograms --- server.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index c6bd74c..15ca237 100644 --- a/server.js +++ b/server.js @@ -90,6 +90,7 @@ function sampleScatterPlotByYears(min_year, max_year){ }) } + function barGraphByDecades(){ client.search({ index: 'million_songs', @@ -98,7 +99,7 @@ function barGraphByDecades(){ query: { range: { year: { - gte: 1920 + gte: 0 } } }, @@ -107,7 +108,8 @@ function barGraphByDecades(){ by_year: { histogram: { field: "year", - interval: 10 // 10 years + interval: 10, // 10 years + min_doc_count: 1 // don't return results unless there's at least 1 thing there }, aggs: { avg_hotttnesss: {