I think you'd have to add 3 stats facets to your query to give the min/max
of:
- available date
- location.lat
- location.lon
Note: you'd need to set your geo-loc field to index lat_lon for this to
work. Also, the lat & lon will not be correlated with each other, but I
think that'd be ok for your case.
So:
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
"mappings" : {
"test" : {
"properties" : {
"loc" : {
"lat_lon" : 1,
"type" : "geo_point"
},
"available" : {
"type" : "date"
}
}
}
}
}
'
curl -XPOST 'http://127.0.0.1:9200/test/test?pretty=1' -d '
{
"loc" : {
"lat" : 40,
"lon" : 50
},
"available" : "2013-05-10"
}
'
curl -XPOST 'http://127.0.0.1:9200/test/test?pretty=1' -d '
{
"loc" : {
"lat" : 42,
"lon" : 49
},
"available" : "2013-05-12"
}
'
curl -XGET 'http://127.0.0.1:9200/test/test/_search?pretty=1' -d '
{
"facets" : {
"lat" : {
"statistical" : {
"field" : "loc.lat"
}
},
"lon" : {
"statistical" : {
"field" : "loc.lon"
}
},
"available" : {
"statistical" : {
"field" : "available"
}
}
},
"size" : 0
}
'
{
"hits" : {
"hits" : ,
"max_score" : 1,
"total" : 2
},
"timed_out" : false,
"_shards" : {
"failed" : 0,
"successful" : 5,
"total" : 5
},
"facets" : {
"lat" : {
"count" : 2,
"variance" : 1,
"std_deviation" : 1,
"min" : 40,
"max" : 42,
"_type" : "statistical",
"mean" : 41,
"total" : 82,
"sum_of_squares" : 3364
},
"lon" : {
"count" : 2,
"variance" : 0.25,
"std_deviation" : 0.5,
"min" : 49,
"max" : 50,
"_type" : "statistical",
"mean" : 49.5,
"total" : 99,
"sum_of_squares" : 4901
},
"available" : {
"count" : 2,
"variance" : 7.46495998217421e+15,
"std_deviation" : 86399999.8968415,
"min" : 1368144000000,
"max" : 1368316800000,
"_type" : "statistical",
"mean" : 1368230400000,
"total" : 2736460800000,
"sum_of_squares" : 3.74410886989824e+24
}
},
"took" : 8
}
On Tue, May 14, 2013 at 7:20 PM, David Pilato david@pilato.fr wrote:
Sorry. I thought that you were looking to compute a String based on doc
content itself.
I have no more idea right now…
May be someone else???
--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs
Le 14 mai 2013 à 14:34, ian mayo ian@planetmayo.com a écrit :
thanks for the prompt reply David,
the scripts capability would appear to just allow me to return the
individual temporal/spatial bounds for each document - but I'm already
getting these in my search returns
I guess that in the NoSQL context the scripts would give me my Map
function, but I still need a Reduce function to give me the overall range.
This seems similar to the facets query parameter: for the requested
facets, this gives me a count of how many documents match that facet. I'm
hoping for a similar capability that tells me the time-period, geo-bounds
for the overall set of returns.
Cheers,
Ian
On Tuesday, 14 May 2013 09:38:22 UTC+1, David Pilato wrote:
May be script fields? http://www.Elasticsearch Platform — Find real-time answers at scale | Elastic
reference/api/search/script-**fields/http://www.elasticsearch.org/guide/reference/api/search/script-fields/
--
David Pilato | Technical Advocate | Elasticsearch.comhttp://elasticsearch.com/
*
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
|* @scrutmydocs https://twitter.com/scrutmydocs
Le 14 mai 2013 à 10:21, ian mayo i...@planetmayo.com a écrit :
I've got a faceted search page that's working really well, supported by
Elasticsearch.
Many of my documents have start/end, plus geo-bounds attributes.
So, in addition to returning the matching documents, plus a list of facet
scores, I'd like ES to return the temporal and spatial bounds of the
matching documents.
i.e. a plain-english translation of the actual search returns would be
"12 property rentals with free wifi are available for under $100 per week"
I wish to extend the returned info to received: "12 property rentals with
free wifi are available for under $100 per week, the available dates
range from 1st June to 12th July and they're located from 12.1N, 3.2E to
15.2N, 5.5E"
I can't find the terms to use in the API guide for this, but I don't
really know what I'm looking for.
Any tips would be most welcome.
Cheers,
Ian
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@**googlegroups.com.
For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
.
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.