alliance-genome / agr_archive_initial_prototype

Source code for the Alliance of Genome Resources web portal
http://prod.alliancegenome.org/
MIT License
6 stars 11 forks source link

Look into moving Elasticsearch queries into templates #111

Open kevinschaper opened 7 years ago

kevinschaper commented 7 years ago

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html

It looks like we can build stored templates for the queries. They can be pushed into the ES cluster (like the mapping is), and should make it much easier to tune & debug queries.

oblodgett commented 7 years ago

What about using something like the following:

https://github.com/Fizzadar/ElasticQuery https://github.com/elastic/elasticsearch-dsl-py

We could have each Domain Model now how to map itself, and build a query for itself. Field lists could be generated from each DM?

We wouldn't have to manage "template" files, where field names change in the mapping file and in the template files and in the DM. The mapping and query building could be generated directly from a DM and then we would only need to change fields in one spot.

cmpich commented 7 years ago

Definitely an improvement. I do hope we eventually will put our 'base data' into a relational database and then use some kind of ORM (object-relational-mapping) to talk to the database.