You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the API supports bulk index and delete. It would be nice to have a bulk_update, which would allow partial updates to indexed documents. The API calls could look something like this:
classRecordIndexer(object):
...
defbulk_update(self, record_patch_iterator):
# record_patch_iterator is a iterable of 2-tuples with a record UUID # and a dictionary with the patch/update (see example below)self._bulk_op(record_patch_iterator, 'update')
def_bulk_op(self, record_id_iterator, op_type, index=None, doc_type=None):
withself.create_producer() asproducer:
ifop_type=='update':
forrec, patchinrecord_id_iterator:
producer.publish(dict(
id=str(rec),
patch=patch,
op='update',
index=index,
doc_type=doc_type
))
else:
...
def_update_action(self, payload):
...
return {
'_op_type': 'delete',
'_index': index,
'_type': doc_type,
'_id': payload['id'],
'doc': payload['patch']
}
RecordIndexer().bulk_update(
['<some-record-uuid>', {'_stats': {'views': 42, 'downloads': 420}}],
['<some-record-uuid>', {'_stats': {'views': 100, 'downloads': 200}}],
...
)
The text was updated successfully, but these errors were encountered:
Currently, the API supports bulk
index
anddelete
. It would be nice to have abulk_update
, which would allow partial updates to indexed documents. The API calls could look something like this:The text was updated successfully, but these errors were encountered: