Store strategy and complicated query/aggregation

Hi, I'm using Elasticsearch 6.7.2 and have some questions ...

  1. When I store data with "float" type, will it be transform to string or always float? I think this may need different space between 2 types.

  2. My index mappings example is shown below, we record user's body height and weight.
    If user add a new record, we create a new document with same "user_id" and "gender", which means there will be several documents have same user_id and gender.
    2.1) "user_id" and "gender" data will be only stored once or as many as number of documents?
    2.2) When I do query or aggregation,
    e.g. 1) Aggregate Male's average height, using the "height" from same "user_id" by choosing the newest document.
    e.g. 2) Query(filter) "height" between 170 ~ 179(cm), and the same "user_id" will only present the newest one.

Example:

> "mappings" : {
>   "_doc" : {
>     "properties" : {
>       "user_id" : {
>         "type" : "text"
>       }
>       "created_at" : {
>         "type" : "date"
>       },
>       "gender" : {
>         "type" : "bool"
>       },
>       "height" : {
>         "type" : "float"
>       },
>       "weight" : {
>         "type" : "float"
>       }
>     }
>   }
> }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.