-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API de metadatos para Field #187
Conversation
def __init__(self): | ||
self.elastic = ElasticInstance.get() | ||
|
||
def index(self, datajson_url): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talvez datajson_url (o un objecto DataJson) debería ser una variable de instancia en vez de andar pasandolo como referencia?
elastic = ElasticInstance.get() | ||
for success, info in parallel_bulk(elastic, actions): | ||
if not success: | ||
print(info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Podemos usar el loggin default de django? Talvez dejando un método como para una futura implementacion de un mail de "Indexados/fallidos/totales"
actions = [] | ||
for field in data_json.get_fields(): | ||
if field.get('specialType'): | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Una forma de implementar el for sin el continue
? 🤔
offset = self.args[constants.PARAM_OFFSET] | ||
limit = self.args[constants.PARAM_LIMIT] | ||
search = Field.search(using=es_client).query('match', _all=querystring) | ||
search = search[offset:limit + offset] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A elasticsearch no le podés pasar ya el offset y el limit?
https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-request-from-size.html
o asi se hace con la libreria elasticsearch-dsl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se hace así
series_tiempo_ar_api/urls.py
Outdated
@@ -15,5 +15,6 @@ | |||
url(r'^django-rq/', include('django_rq.urls')), | |||
url(r'^api/', include('series_tiempo_ar_api.apps.api.urls', namespace="api")), | |||
url(r'^analytics/', include('series_tiempo_ar_api.apps.analytics.urls', namespace='analytics')), | |||
url(r'^metadata/', include('series_tiempo_ar_api.apps.metadata.urls', namespace='metadata')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se puede poner la url para que quede como "hermana" de /series/
O sea, /api/metadata/
en vez de /metadata/
Closes #169
Primera versión de la API de metadatos.
libs
metadata
con un endpointmetadata/search
: acepta parámetrosq
,limit
yoffset
. Los datos se cargan manualmente corriendo el management commandindex_metadata [datajson_url]