Hi,
I'm a new es user but love what I've seen so far. I'm using 0.90.0.
I have a simple mapping defined like this:
{
"mappings" : {
"user" : {
"properties" : {
"user_name" : {
"type" : "string",
"index_options" : "freqs",
"boost" : 3.0
},
"handle" : {
"type" : "string",
"index_options" : "docs"
},
"bio" : {
"type" : "string",
"index_options" : "freqs"
},
"location" : {
"type" : "geo_point",
"lat_lon" : true
}
}
},
"post" : {
"properties" : {
"text" : {
"type" : "string",
"index_options" : "freqs"
},
"location" : {
"type" : "geo_point",
"lat_lon" : true
}
}
}
}
}
I've loaded around 50k entries into the index.
I want to be able to perform searches based on text and optionally filtered
by a geo_bounding_box.
If I issue the following search, it works beautifully:
curl -XGET localhost:9200/wotzere/_search?pretty=1 -d '
{
"fields" : [ "_id", "_type", "location" ],
"from" : 0,
"size" : 20,
"query" : {
"match": {
"_all" : "chill ice lodge"
}
}
}'
It returns:
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1170,
"max_score" : 2.2864966,
"hits" : [ {
"_index" : "wotzere",
"_type" : "user",
"_id" : "80248",
"_score" : 2.2864966,
"fields" : {
"location" : [ "145.0450", "-37.8232" ]
}
}, {
"_index" : "wotzere",
"_type" : "user",
"_id" : "66694",
"_score" : 1.3186983,
"fields" : {
"location" : [ "144.9679", "-37.8205" ]
}
}, {
"_index" : "wotzere",
"_type" : "user",
"_id" : "72829",
"_score" : 0.76025414,
"fields" : {
"location" : [ "151.3003", "-32.7730" ]
}
}, {
"_index" : "wotzere",
"_type" : "user",
"_id" : "70022",
"_score" : 0.6828435,
"fields" : {
"location" : [ "150.2991", "-34.6497" ]
}
}, {
"_index" : "wotzere",
"_type" : "post",
"_id" : "138114",
"_score" : 0.52798617,
"fields" : {
"location" : [ "130.8392", "-12.4630" ]
}
}, {
:
} ]
}
}
For the life of me I can't get a geo_bounding_box filter to work - even on
its own. Would some kind soul please point me in the right direction by
incorporating a bounding box of (lat, long) tl => (-10, 110), br => (-44,
155) into my original search criteria?
One thing that's not clear to me. If I have a field called "location" in
both my types (user, post), do I need to specify both in separate
geo_bounding_box filters or can I do it with a single, unqualified filter
(sort of like what I'm doing with the "_all" of the original criteria)?
Thanks so much.
Steve
--
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.