# Store strategy and complicated query/aggregation

**URL:** <https://discuss.elastic.co/t/store-strategy-and-complicated-query-aggregation/218967>\
**Category:** Elasticsearch\
**Created:** [February 12, 2020, 11:58am UTC](https://discuss.elastic.co/t/store-strategy-and-complicated-query-aggregation/218967 "2020-02-12T11:58:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![edisonyang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/edisonyang/32/69895_2.png) [@edisonyang](https://discuss.elastic.co/u/edisonyang)\
**Post date:** [February 12, 2020, 11:58am UTC](https://discuss.elastic.co/t/store-strategy-and-complicated-query-aggregation/218967/1 "2020-02-12T11:58:41Z")

</div>

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"
> }
> }
> }
> }
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 11, 2020, 11:58am UTC](https://discuss.elastic.co/t/store-strategy-and-complicated-query-aggregation/218967/2 "2020-03-11T11:58:41Z")

</div>

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