How to make full text search for data range?


We are trying to make full text search on a string , it is searching entire collection and returning the data.

Similarly we are trying to make full search on date range using REST call, but it is not giving any proper results.
_search?q=john==> working

_search?q=[2014-10-09 TO 2015-10-12] ==> not working

Please let us know how to create the request uri for full search on date range

I think you need to specify the date/time field name for this search.


the query string uri-search only exposes a very limited amount of the search power of elasticsearch. Its more designed for quick tests and forwards to the Query String Query. While this also supports ranges, it is safer to change to use the proper _search endpoint as described in the Rest Body Search examples and then use the Range Query.

Hi ,

Thank you for responses. I want full search without field name. it should search in all date fields.
Please provide some sample in javascript or c# if we want to use request body for the date range full search

I'm afraid you need to specify the field name. For strings this is also necessary, but you don't notice it right away because when not explicitly specifying the field to search on, index.query.default_field will be used which by default it set to the _all field. This field, however, because it only stores string representations, is not usable in range queries.

@bhavani in addition to what @cbuescher said, the _all field may also have more than one date string in it, do not expect ES to pick the one you think it should use. It does not know that. That's why for a date range query, you need to use a date time field.