Query string on float

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.

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

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

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.

Thank you, you save my day !

This work perfectly:

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

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