From 1b3317923a3bb319eefb87564143a88405341524 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sat, 23 Nov 2019 17:39:27 +0100 Subject: [PATCH] revert from calendar_interval to interval --- app/models/client.rb | 2 +- app/models/doi.rb | 6 +++--- app/models/event.rb | 12 ++++++------ app/models/provider.rb | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/models/client.rb b/app/models/client.rb index 4629a468e..b9f0edcb1 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -246,7 +246,7 @@ def self.query_fields def self.query_aggregations { - years: { date_histogram: { field: 'created', calendar_interval: 'year', min_doc_count: 1 } }, + years: { date_histogram: { field: 'created', interval: 'year', min_doc_count: 1 } }, cumulative_years: { terms: { field: 'cumulative_years', min_doc_count: 1, order: { _count: "asc" } } }, providers: { terms: { field: 'provider_id', size: 15, min_doc_count: 1 } }, software: { terms: { field: 'software.keyword', size: 15, min_doc_count: 1 } }, diff --git a/app/models/doi.rb b/app/models/doi.rb index bcaa897f0..d262ae2f8 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -463,9 +463,9 @@ def self.query_aggregations { resource_types: { terms: { field: 'types.resourceTypeGeneral', size: 15, min_doc_count: 1 } }, states: { terms: { field: 'aasm_state', size: 15, min_doc_count: 1 } }, - years: { date_histogram: { field: 'publication_year', calendar_interval: 'year', min_doc_count: 1 } }, - created: { date_histogram: { field: 'created', calendar_interval: 'year', min_doc_count: 1 } }, - registered: { date_histogram: { field: 'registered', calendar_interval: 'year', min_doc_count: 1 } }, + years: { date_histogram: { field: 'publication_year', interval: 'year', min_doc_count: 1 } }, + created: { date_histogram: { field: 'created', interval: 'year', min_doc_count: 1 } }, + registered: { date_histogram: { field: 'registered', interval: 'year', min_doc_count: 1 } }, providers: { terms: { field: 'provider_id', size: 15, min_doc_count: 1} }, clients: { terms: { field: 'client_id', size: 15, min_doc_count: 1 } }, affiliations: { terms: { field: 'creators.affiliation.affiliationIdentifier', size: 15, min_doc_count: 1 } }, diff --git a/app/models/event.rb b/app/models/event.rb index be8cabec6..cab438262 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -214,10 +214,10 @@ def self.query_aggregations(doi=nil) { sources: { terms: { field: 'source_id', size: 50, min_doc_count: 1 } }, prefixes: { terms: { field: 'prefix', size: 50, min_doc_count: 1 } }, - registrants: { terms: { field: 'registrant_id', size: 50, min_doc_count: 1 }, aggs: { year: { date_histogram: { field: 'occurred_at', calendar_interval: 'year', min_doc_count: 1 }, aggs: { "total_by_year" => { sum: { field: 'total' }}}}} }, + registrants: { terms: { field: 'registrant_id', size: 50, min_doc_count: 1 }, aggs: { year: { date_histogram: { field: 'occurred_at', interval: 'year', min_doc_count: 1 }, aggs: { "total_by_year" => { sum: { field: 'total' }}}}} }, pairings: { terms: { field: 'registrant_id', size: 50, min_doc_count: 1 }, aggs: { recipient: { terms: { field: 'registrant_id', size: 50, min_doc_count: 1 }, aggs: { "total" => { sum: { field: 'total' }}}}} }, - citation_types: { terms: { field: 'citation_type', size: 50, min_doc_count: 1 }, aggs: { year_months: { date_histogram: { field: 'occurred_at', calendar_interval: 'month', min_doc_count: 1 }, aggs: { "total_by_year_month" => { sum: { field: 'total' }}}}} }, - relation_types: { terms: { field: 'relation_type_id', size: 50, min_doc_count: 1 }, aggs: { year_months: { date_histogram: { field: 'occurred_at', calendar_interval: 'month', min_doc_count: 1 }, aggs: { "total_by_year_month" => { sum: { field: 'total' }}}},"sum_distribution"=>sum_distribution} }, + citation_types: { terms: { field: 'citation_type', size: 50, min_doc_count: 1 }, aggs: { year_months: { date_histogram: { field: 'occurred_at', interval: 'month', min_doc_count: 1 }, aggs: { "total_by_year_month" => { sum: { field: 'total' }}}}} }, + relation_types: { terms: { field: 'relation_type_id', size: 50, min_doc_count: 1 }, aggs: { year_months: { date_histogram: { field: 'occurred_at', interval: 'month', min_doc_count: 1 }, aggs: { "total_by_year_month" => { sum: { field: 'total' }}}},"sum_distribution"=>sum_distribution} }, dois: { terms: { field: 'obj_id', size: 50, min_doc_count: 1 }, aggs: { relation_types: { terms: { field: 'relation_type_id',size: 50, min_doc_count: 1 }, aggs: { "total_by_type" => { sum: { field: 'total' }}}}} }, dois_usage: { filter: { script: { script: "doc['source_id'].value == 'datacite-usage' && doc['occurred_at'].size() > 0 && doc['obj.datePublished'].size() > 0 && doc['occurred_at'].value.getMillis() >= doc['obj.datePublished'].value.getMillis() && doc['occurred_at'].value.getMillis() < new Date().getTime()" }}, @@ -230,7 +230,7 @@ def self.query_aggregations(doi=nil) script: "#{INCLUDED_RELATION_TYPES}.contains(doc['relation_type_id'].value)" } }, - aggs: { years: { date_histogram: { field: 'occurred_at', calendar_interval: 'year', min_doc_count: 1 }, aggs: { "total_by_year" => { sum: { field: 'total' }}}},"sum_distribution"=>sum_year_distribution} + aggs: { years: { date_histogram: { field: 'occurred_at', interval: 'year', min_doc_count: 1 }, aggs: { "total_by_year" => { sum: { field: 'total' }}}},"sum_distribution"=>sum_year_distribution} } } end @@ -255,7 +255,7 @@ def self.metrics_aggregations(doi = nil) views_histogram: { filter: views_filter, aggs: { - year_months: { date_histogram: { field: 'occurred_at', calendar_interval: 'month', min_doc_count: 1 }, aggs: { "total_by_year_month" => { sum: { field: 'total' } } } }, "sum_distribution" => sum_distribution + year_months: { date_histogram: { field: 'occurred_at', interval: 'month', min_doc_count: 1 }, aggs: { "total_by_year_month" => { sum: { field: 'total' } } } }, "sum_distribution" => sum_distribution } }, downloads: { @@ -267,7 +267,7 @@ def self.metrics_aggregations(doi = nil) downloads_histogram: { filter: downloads_filter, aggs: { - year_months: { date_histogram: { field: 'occurred_at', calendar_interval: 'month', min_doc_count: 1 }, aggs: { "total_by_year_month" => { sum: { field: 'total' } } } }, "sum_distribution" => sum_distribution + year_months: { date_histogram: { field: 'occurred_at', interval: 'month', min_doc_count: 1 }, aggs: { "total_by_year_month" => { sum: { field: 'total' } } } }, "sum_distribution" => sum_distribution } } } diff --git a/app/models/provider.rb b/app/models/provider.rb index 8bf3be448..73ca74639 100644 --- a/app/models/provider.rb +++ b/app/models/provider.rb @@ -233,7 +233,7 @@ def self.query_fields def self.query_aggregations { - years: { date_histogram: { field: 'created', calendar_interval: 'year', min_doc_count: 1 } }, + years: { date_histogram: { field: 'created', interval: 'year', min_doc_count: 1 } }, cumulative_years: { terms: { field: 'cumulative_years', min_doc_count: 1, order: { _count: "asc" } } }, regions: { terms: { field: 'region', size: 10, min_doc_count: 1 } }, member_types: { terms: { field: 'member_type', size: 10, min_doc_count: 1 } },