Skip to content

Commit

Permalink
use interval parameter. datacite/datacite#359
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Nov 21, 2019
1 parent 4522215 commit 5aaca85
Showing 1 changed file with 33 additions and 30 deletions.
63 changes: 33 additions & 30 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -484,38 +484,41 @@ def self.query_aggregations
end

def self.totals_aggregations
# {
# providers_totals: {
# composite: {
# sources: [
# { provider: { terms: { field: "provider_id", size: ::Provider.__elasticsearch__.count, min_doc_count: 1 } } },
# { year: { date_histogram: { field: "created", calendar_interval: "year", format: "yyyy" } } }
# ]
# }
# },
# clients_totals: {
# composite: {
# sources: [
# { client: { terms: { field: "client_id", size: ::Client.__elasticsearch__.count, min_doc_count: 1 } } },
# { year: { date_histogram: { field: "created", calendar_interval: "year", format: "yyyy" } } }
# ]
# }
# },
# prefixes_totals: {
# composite: {
# sources: [
# { prefix: { terms: { field: "prefix", size: ::Prefix.count, min_doc_count: 1 } } },
# { year: { date_histogram: { field: "created", calendar_interval: "year", format: "yyyy" } } }
# ]
# }
# }
# }

{
providers_totals: { terms: { field: 'provider_id', size: 50, min_doc_count: 1 }, aggs: sub_aggregations },
clients_totals: { terms: { field: 'client_id', size: 50, min_doc_count: 1 }, aggs: sub_aggregations },
prefixes_totals: { terms: { field: 'prefix', size: 50, min_doc_count: 1 }, aggs: sub_aggregations },
providers_totals: {
composite: {
size: 50,
sources: [
{ provider: { terms: { field: "provider_id", size: ::Provider.__elasticsearch__.count, min_doc_count: 1 } } },
{ year: { date_histogram: { field: "created", interval: "year", format: "yyyy" } } }
]
}
},
clients_totals: {
composite: {
size: 50,
sources: [
{ client: { terms: { field: "client_id", size: ::Client.__elasticsearch__.count, min_doc_count: 1 } } },
{ year: { date_histogram: { field: "created", interval: "year", format: "yyyy" } } }
]
}
},
prefixes_totals: {
composite: {
size: 50,
sources: [
{ prefix: { terms: { field: "prefix", size: ::Prefix.count, min_doc_count: 1 } } },
{ year: { date_histogram: { field: "created", interval: "year", format: "yyyy" } } }
]
}
}
}

# {
# providers_totals: { terms: { field: 'provider_id', size: 50, min_doc_count: 1 }, aggs: sub_aggregations },
# clients_totals: { terms: { field: 'client_id', size: 50, min_doc_count: 1 }, aggs: sub_aggregations },
# prefixes_totals: { terms: { field: 'prefix', size: 50, min_doc_count: 1 }, aggs: sub_aggregations },
# }
end

def self.sub_aggregations
Expand Down

0 comments on commit 5aaca85

Please sign in to comment.