-
Notifications
You must be signed in to change notification settings - Fork 46
Build endpoints to access API metadata #57
Comments
To this I'd like to add date aggregation, to show populated dates or ranges for the data that we have. Could be a separate endpoint or parameter, but the work should be similar to get here. |
Should the |
Not quite sure I understand the question. Could you give an example of the route (and perhaps a quick mockup of what it might return) that you have in mind? |
To achieve a "a new API endpoint to hit and get all available data_sources":
app.get('/v0/data_sources', function(req, res) {
res.json({
results: [
'fbo.gov', 'grants.gov', 'dodsbir.net', 'bids.state.gov'
]
});
}); Is this fine? or is there a dynamic way to populate the |
Gotcha. These should be dynamically populated. See the Elasticsearch sample aggregation code at the top of the Issue. Also we may want to name the route a bit differently, but I will need to think on it and we should discuss with the group. |
Great, very clarifying. Is there any code we have that already does something similar? I'm guessing that the aggregation code gets passed to ( |
Yes, JSON can be passed directly to |
Looks like this is the answer. * studies docs * ... |
So far app.get('/v0/data_sources', function(req, res) {
client.search({
index: config.elasticsearch.index,
type: 'opp',
body: ejs.TermsAggregation({name: 'data_source'})
}, function(err, body) {
res.json(body)
});
}); outputs:
|
#151 implements the |
Issue #57: Add /agg endpoints to show unique data_sources, notice_types, and notice_types by data_source.
Requested fields to get unique values for are:
data_source
notice_type
Unique notice_types can be gotten via this aggregation:
The text was updated successfully, but these errors were encountered: