Problem with "date query url" and "wildcards with integer"

Hello,

I have some problemes to build integer and wildcards.

http://localhost:9200/index/type/_search?q=Id:1*

If this is my query and my object looks like this:

_source:{
Id: 126
}

It should return the object with the Id: 126 or not?

The Second problem I have is to build a query with a date range. Date are
formated as strings.
My Object looks like this:

_source:{
ManufacturingDate: "2012/10/24 18:18:09"
}

I thought query should look like this:

http:
//localhost:9200/index/type/_search?q=ManufacturingDate:2010-10-24TO2012-10-24

or

http:
//localhost:9200/index/type/_search?q=ManufacturingDate:2010-10-24TO2012-10-24

Does anyone have some hints or suggestions for me?

Thanks in advance.

Chris

--

I don't think it will work with integers. Does it make sense?
With numbers, you probably want to do range queries and not wildcard.
If you really need wildcard, that means that you consider your field as a String
and so, you have to send it like: "id" : "126"

For query string syntax, I suggest that you give a look at:
http://lucene.apache.org/core/old_versioned_docs/versions/2_9_1/queryparsersyntax.html

For example, I suppose that you can run something like:

ManufacturingDate:[20101024 TO 20121224]

But, I recommand to use the QueryDSL:

(For example:
Elasticsearch Platform — Find real-time answers at scale | Elastic)

Does it help?
David.

Le 5 décembre 2012 à 14:20, Jens Christian Groh groh@dtis.eu a écrit :

Hello,

I have some problemes to build integer and wildcards.

http : //localhost:9200/index/type/_search?q=Id:1*

If this is my query and my object looks like this:

_source :{
Id : 126
}

It should return the object with the Id: 126 or not?

The Second problem I have is to build a query with a date range. Date are
formated as strings.
My Object looks like this:

_source :{
ManufacturingDate : "2012/10/24 18:18:09"
}

I thought query should look like this:

http :
//localhost:9200/index/type/_search?q=ManufacturingDate:2010-10-24TO2012-10-24

or

http :
//localhost:9200/index/type/_search?q=ManufacturingDate:2010-10-24TO2012-10-24

Does anyone have some hints or suggestions for me?

Thanks in advance.

Chris

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--