@@ -189,8 +189,11 @@ def update(self, index, iterable, commit=True):
189
189
190
190
bulk (self .conn , prepped_docs , index = self .index_name , doc_type = 'modelresult' )
191
191
192
- # if commit:
193
- # self.conn.indices.refresh(index=self.index_name)
192
+ # We are explicitly eliminating the call to self.conn.indices.refresh().
193
+ # ElasticSearch will do an automatic refresh once per minute. Manually invoking refresh
194
+ # on every update triggers 1000's of unnecessary API calls.
195
+ # The underlying issue is that neither SearchIndex.update nor SearchIndex.update_object
196
+ # pass kwargs to this method, so setting commit to False does not solve the problem.
194
197
195
198
def remove (self , obj_or_string , commit = True ):
196
199
doc_id = get_identifier (obj_or_string )
@@ -209,8 +212,10 @@ def remove(self, obj_or_string, commit=True):
209
212
try :
210
213
self .conn .delete (index = self .index_name , doc_type = 'modelresult' , id = doc_id , ignore = 404 )
211
214
212
- # if commit:
213
- # self.conn.indices.refresh(index=self.index_name)
215
+ # We are explicitly eliminating the call to self.conn.indices.refresh().
216
+ # ElasticSearch will do an automatic refresh once per minute. Manually invoking refresh
217
+ # on every remove triggers 1000's of unnecessary API calls.
218
+
214
219
except elasticsearch .TransportError as e :
215
220
if not self .silently_fail :
216
221
raise
0 commit comments