# Fscrawler rest service has no filesize field?

**URL:** <https://discuss.elastic.co/t/fscrawler-rest-service-has-no-filesize-field/358630>\
**Category:** Elasticsearch\
**Created:** [May 2, 2024, 10:29am UTC](https://discuss.elastic.co/t/fscrawler-rest-service-has-no-filesize-field/358630 "2024-05-02T10:29:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![laoyang360](https://avatars.discourse-cdn.com/v4/letter/l/a9a28c/32.png) [@laoyang360](https://discuss.elastic.co/u/laoyang360)\
**Post date:** [May 2, 2024, 10:29am UTC](https://discuss.elastic.co/t/fscrawler-rest-service-has-no-filesize-field/358630/1 "2024-05-02T10:29:44Z")

</div>

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?

```auto
          "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.

```auto
      "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.

```auto
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! !

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 2, 2024, 8:00pm UTC](https://discuss.elastic.co/t/fscrawler-rest-service-has-no-filesize-field/358630/2 "2024-05-02T20:00:41Z")

</div>

Hey.

That's definitely a miss.

I created this PR:

> <https://github.com/dadoonet/fscrawler/pull/1868>
>
> As reported in https://discuss.elastic.co/t/358630
> 
> Filesize is missing when u…sing the Rest service.

I hope to be able to merge it in some minutes so you might have a new build available in a couple of hours.

---

<div class="post-metadata">

**Author:** ![laoyang360](https://avatars.discourse-cdn.com/v4/letter/l/a9a28c/32.png) [@laoyang360](https://discuss.elastic.co/u/laoyang360)\
**Post date:** [May 3, 2024, 5:19am UTC](https://discuss.elastic.co/t/fscrawler-rest-service-has-no-filesize-field/358630/3 "2024-05-03T05:19:04Z")

</div>

Thank you for your reply!

I used the newest packages, but when I upload file, the filesize = -1,

> <https://github.com/dadoonet/fscrawler/pull/1868>
>
> As reported in https://discuss.elastic.co/t/358630
> 
> Filesize is missing when u…sing the Rest service.
