Skip to content

Commit

Permalink
revert from calendar_interval to interval
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Nov 23, 2019
1 parent d683cb8 commit 1b33179
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/models/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 } },
Expand Down
6 changes: 3 additions & 3 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 } },
Expand Down
12 changes: 6 additions & 6 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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()" }},
Expand All @@ -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
Expand All @@ -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: {
Expand All @@ -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
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 } },
Expand Down

0 comments on commit 1b33179

Please sign in to comment.