CDRH / api

Codenamed "Apium": An API to access all public Center for Digital Research in the Humanities resources
https://cdrhdev1.unl.edu/api_frontend
MIT License
3 stars 1 forks source link

Implement date range hard options (century, month, decade) #31

Closed jduss4 closed 6 years ago

jduss4 commented 7 years ago

Right now date_field.year is supported, but we should implement some more non-adjustable ranges, also

If these are implemented, the behavior should be implementable if the backend was switched to solr.

jduss4 commented 7 years ago

Will probably have to use date range query to get at decade and century, unfortunately.

However, you can do something like this, if you don't care that much about accuracy!

      "date.3650d": {
        "1890-01-20": 450,
        "1910-01-16": 349,
        "1920-01-14": 330,
        "1880-01-23": 204,
        "1900-01-18": 187,
        "1930-01-11": 139,
        "1950-01-06": 138,
jduss4 commented 7 years ago

Date histogram docs (what API uses now): https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html

Date range docs (what API may need to use for decade / century): https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-daterange-aggregation.html

karindalziel commented 6 years ago

For now let's handle this using custom fields on ingest