# Query string on float

**URL:** <https://discuss.elastic.co/t/query-string-on-float/91941>\
**Category:** Elasticsearch\
**Created:** [July 5, 2017, 3:08pm UTC](https://discuss.elastic.co/t/query-string-on-float/91941 "2017-07-05T15:08:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ogauchard](https://avatars.discourse-cdn.com/v4/letter/o/3da27b/32.png) [@ogauchard](https://discuss.elastic.co/u/ogauchard)\
**Post date:** [July 5, 2017, 3:08pm UTC](https://discuss.elastic.co/t/query-string-on-float/91941/1 "2017-07-05T15:08:56Z")

</div>

Hi all,

I have documents with a float field defined as follows:

```
"amount": {
    "type": "float"
}

```

When I get a document, I can see the field as follows:

`"amount": 9250`

But if I do a query string like the following, the document is not found:

```
{
    "query_string": {
        "query": "9250"
    }
}

```

And if I do a query like the following, the document is found:

```
{
    "query_string": {
        "query": "amount:9250"
    }
}

```

Is there a way to retrieve float fields using query string without specifying the field name (i.e. using \_all by default) ?

Thank you.

---

<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:** [July 5, 2017, 3:44pm UTC](https://discuss.elastic.co/t/query-string-on-float/91941/2 "2017-07-05T15:44:53Z")

</div>

I'm wondering if the float field has been copied to \_all field. A way to check that is to store it and then ask for it back when running \_search: [https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-all-field.html#all-field-store](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-all-field.html#all-field-store)

Better option is to use copy\_to feature: [https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-all-field.html#custom-all-fields](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping-all-field.html#custom-all-fields)

Also you can may be run \*:value which will run on every field. May be changing default field from \_all to \* would work but I'm unsure.

Note that in 6.0 \_all field is removed.

---

<div class="post-metadata">

**Author:** ![ogauchard](https://avatars.discourse-cdn.com/v4/letter/o/3da27b/32.png) [@ogauchard](https://discuss.elastic.co/u/ogauchard)\
**Post date:** [July 5, 2017, 3:59pm UTC](https://discuss.elastic.co/t/query-string-on-float/91941/3 "2017-07-05T15:59:58Z")

</div>

Thank you, you save my day !

This work perfectly:

```
{
    "query_string": {
        "default_field": "*",
        "query": "9250"
    }
}
```

---

<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:** [August 2, 2017, 4:00pm UTC](https://discuss.elastic.co/t/query-string-on-float/91941/4 "2017-08-02T16:00:10Z")

</div>

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