GeoPoint boost at mapping time


(Kina Shah) #1

Hi,

What's the best way to give a GeoPoint boost at the mapping time?

I added a boost to List of GeoPoint field at the mapping time, but I don't
see it doing anything with the score returned when I search on that
geoPoint.

Here's how I added it in.
.startObject()
.startObject(TYPE)
.startObject("properties")
.startObject("sen_location").field("type",
"geo_shape").field("geohash", true).field("geohash_prefix",
true).endObject()
.startObject("fc_location").field("type",
"geo_shape").field("geohash", true).field("geohash_prefix",
true).endObject()
.startObject("tgt_location").field("type",
"geo_shape").field("geohash", true).field("geohash_prefix",
true).endObject()

.startObject("corner_location").field("type", "geo_shape").field("geohash",
true).field("lat_lon", true).field("geohash_prefix", true).endObject()

.startObject("senGeoPointLst").field("type", "geo_point").field("geohash",
true).field("lat_lon", true).field("geohash_prefix", true).field("boost",
1).endObject()
.startObject("fcGeoPointLst").field("type",
"geo_point").field("geohash", true).field("lat_lon",
true).field("geohash_prefix", true).field("boost", 3).endObject()

.startObject("tgtGeoPointLst").field("type", "geo_point").field("geohash",
true).field("lat_lon", true).field("geohash_prefix", true).field("boost",
2).endObject()

.startObject("cornerGeoPointLst").field("type",
"geo_point").field("geohash", true).field("lat_lon",
true).field("geohash_prefix", true).field("boost", 4).endObject()
.startObject("toaDTimeMin").field("type",
"date").field("format", "date_time").endObject()
.startObject("toaDTimeMax").field("type",
"date").field("format", "date_time").endObject()
.endObject()
.endObject()
.endObject();

Is this correct? Why its not working?

Thanks!

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/442d13f6-a916-4ce9-a94e-2f2bcefdba2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #2

I am curious, what is your objective? Are you trying to do a geo search and
rank locations that are closer in distance to a certain point higher in the
hits result list?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f3e341d6-1d84-41a4-8d38-1101996b4e07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Kina Shah) #3

Binh,

I have three different list of geopoints and I want to rank the document
according to which set of geopoint matched the given geopoint within the
radium given. So if you see I have given different boost number to each of
these three geopoints.
Thanks!

On Thursday, March 27, 2014 2:17:35 PM UTC-4, Binh Ly wrote:

I am curious, what is your objective? Are you trying to do a geo search
and rank locations that are closer in distance to a certain point higher in
the hits result list?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bc76ed0e-52f8-4da7-94d2-5ab3cea713b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #4

You can probably do this with a function_score query. The idea is something
like this:

localhost:9200/_search
{
"query": {
"function_score": {
"functions": [
{
"filter": {
"geo_distance" : {
"distance" : "1km",
"cornerGeoPointLst" : {
"lat" : 40,
"lon" : -70
}
}
},
"boost_factor": 4
},
{
"filter": {
"geo_distance" : {
"distance" : "1km",
"fcGeoPointLst" : {
"lat" : 40,
"lon" : -70
}
}
},
"boost_factor": 3
},
{
"filter": {
"geo_distance" : {
"distance" : "1km",
"tgtGeoPointLst" : {
"lat" : 40,
"lon" : -70
}
}
},
"boost_factor": 2
}
]
}
}
}

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a6ecf1f6-2217-4239-aad7-1052f42251ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Kina Shah) #5

Thanks, Binh! I did try that and that works. I am still curious to find out
if there's any way to add the same during mapping time?

On Thursday, March 27, 2014 12:24:44 PM UTC-4, Kina Shah wrote:

Hi,

What's the best way to give a GeoPoint boost at the mapping time?

I added a boost to List of GeoPoint field at the mapping time, but I don't
see it doing anything with the score returned when I search on that
geoPoint.

Here's how I added it in.
.startObject()
.startObject(TYPE)
.startObject("properties")
.startObject("sen_location").field("type",
"geo_shape").field("geohash", true).field("geohash_prefix",
true).endObject()
.startObject("fc_location").field("type",
"geo_shape").field("geohash", true).field("geohash_prefix",
true).endObject()
.startObject("tgt_location").field("type",
"geo_shape").field("geohash", true).field("geohash_prefix",
true).endObject()

.startObject("corner_location").field("type", "geo_shape").field("geohash",
true).field("lat_lon", true).field("geohash_prefix", true).endObject()

.startObject("senGeoPointLst").field("type", "geo_point").field("geohash",
true).field("lat_lon", true).field("geohash_prefix", true).field("boost",
1).endObject()

.startObject("fcGeoPointLst").field("type", "geo_point").field("geohash",
true).field("lat_lon", true).field("geohash_prefix", true).field("boost",
3).endObject()

.startObject("tgtGeoPointLst").field("type", "geo_point").field("geohash",
true).field("lat_lon", true).field("geohash_prefix", true).field("boost",
2).endObject()

.startObject("cornerGeoPointLst").field("type",
"geo_point").field("geohash", true).field("lat_lon",
true).field("geohash_prefix", true).field("boost", 4).endObject()
.startObject("toaDTimeMin").field("type",
"date").field("format", "date_time").endObject()
.startObject("toaDTimeMax").field("type",
"date").field("format", "date_time").endObject()
.endObject()
.endObject()
.endObject();

Is this correct? Why its not working?

Thanks!

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/68a4e3a2-7c39-44ca-b09c-c439ec1bf579%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #6