https://fscrawler.readthedocs.io/en/latest/admin/fs/rest.html#uploading-a-binary-document
When I upload documents using the upload interface of the rest service, there is no filesize field on the Elasticsearch side. I want to add this field, what should I do?
"meta": {
"author": "Administrator",
"date": "2023-03-13T23:51:00.000+00:00",
"modifier": "Administrator",
"created": "2023-03-07T18:34:00.000+00:00"
},
"file": {
"extension": "docx",
"content_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"indexing_date": "2024-05-02T10:16:24.007+00:00",
"filename": "aaa.docx"
},
"path": {
"virtual": "aaa.docx",
"real": "aaa.docx"
}
}
}
]
In contrast, if local synchronization is used, filesize exists.
"content_type": "application/octet-stream",
"created": "2022-05-31T03:20:21.000+00:00",
"last_modified": "2022-05-31T03:20:21.000+00:00",
"last_accessed": "2024-04-25T17:50:26.931+00:00",
"indexing_date": "2024-04-27T01:35:02.261+00:00",
"filesize": 3928,
"filename": "CNKI-637895928126041810.es6",
"url": "file:/CNKI-637895928126041810.es6"
My attempts below were also in vain.
file.seek( 0, os.SEEK_END )
file_size = file.tell()
file.seek( 0 )
print("file_size=", file_size)
files = {'file': (file.filename, file)}
json_data = {'filesize': file_size}
response = requests.post( FS_WEB_ADDRESS, files=files, json=json_data )
Please give a solution.
Thank you! Many thanks! !