OK, so I have tried unsuccessfully for 2 days now to create a custom mapping for a geo_point field. According to the docs, I can put a file under config/mapping/_default to specify a custom mapping for a geo_point field. So I did like this:
config/mappings/_default/golfcourse.json
"golfcourse":{
"properties":{
"par":{
"type":"long"
},
"phone":{
"type":"string"
},
"numholes":{
"type":"long"
},
"lon":{
"type":"double"
},
"location":{
"properties":{
"type" : "geo_point"
}
},
"address":{
"type":"string"
},
"name":{
"type":"string"
},
"state":{
"type":"string"
},
"lat":{
"type":"double"
},
"coursetype":{
"type":"string"
},
"city":{
"type":"string"
}
}
}
}
Then I index golfcourses based on this schema. When I access the mapping like this http://localhost:8080/index/golfcourse/_mapping I get this:
{
index: { }
}
No mapping!
When I query, the index/golfcourse type I get results for a normal query like this:
http://localhost:9200/index/golfcourse/_search?q=reston
When I run a geo query like this:
curl -XGET http://localhost:9200/index/golfcourse/_search -d '
{
query : {
filtered : {
query : {
match_all : { }
}
,
filter : {
geo_distance : {
distance : "30mi",
lat : 45.2879387963343,
lon : -122.697361707687
}
}
}
}
}'
QueryParsingException[[index] field [lon] is not a geo_point field]
the problem is I have no idea on what the right way to do the mapping is. Unless its dynamic I can't get the mapping override to work, because the docs only give me json snippets. Not a complete mapping file with a full example of a custom mapping.
Please Help!
Regards,
kash.