I have exactly 100 documents were already indexed in Elasticsearch and I need to update each document by adding a new simple field using the following function:
def add_new_field( ):
ES_HOST = {"host" : "localhost", "port" : 9200}
ES= Elasticsearch(hosts = [ES_HOST], timeout = 180)
for i in range(100):
ES.update(
index='history',
doc_type='resources',
id=i,
body={ "doc" : {"square" : i**2} }
)
The problem is: after executing this function, the 'doc_freq' of some terms are more than the expected document_frequency.(note: I have set 'dfs = True').
E.g.: 'term1' exists in all documents (so 'doc_freq' should be 100), instead I got 'doc_freq'=113