tiftif
(tiftif)
December 12, 2011, 12:04am
1
I am trying to map the geo location data of tweets but I keep getting
errors...
curl -XPUT 'http://localhost:9200/media/ '
curl -XPUT 'http://localhost:9200/media/twitter/_mapping ' -d '
{
"geo" : {
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}
}
'
curl -XPUT 'http://localhost:9200/media/twitter/1 ' -d '
{
"geo" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
}
},
"tags" : ["food", "family"],
"text" : "my favorite family restaurant"
}'
curl -XGET 'http://localhost:9200/media/twitter/_search ' -d
'{ "query" : {
"filtered" : {
"query" : {
"field" : { "text" : "restaurant" }
},
"filter" : {
"geo_distance" : {
"distance" : "200km",
"geo.location" : {
"lat" : 40,
"lon" : -70
}
}
}
}
}}'
I get an exception that contains: "failed to find geo_point field
[geo.location]];"
What am I doing wrong?
tiftif
(tiftif)
December 12, 2011, 12:48am
2
Okay, I think I figured out what I was doing wrong. I guess I need to
have a single root element that should probably be the same name as
the type itself.
Here's what works:
curl -XDELETE 'http://localhost:9200/media '
curl -XPUT 'http://localhost:9200/media/ '
curl -XPUT 'http://localhost:9200/media/twitter/_mapping ' -d '
{
"twitter" : {
"properties" : {
"geo" : {
"type" : "object",
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}
}
}
}
'
curl -XPUT 'http://localhost:9200/media/twitter/1 ' -d '
{
"twitter" : {
"geo" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
},
"tags" : ["food", "family"],
"text" : "my favorite family restaurant"
}
}
}'
curl -XGET 'http://localhost:9200/media/twitter/_search ' -d
'{ "query" : {
"filtered" : {
"query" : {
"field" : { "text" : "restaurant" }
},
"filter" : {
"geo_distance" : {
"distance" : "200km",
"geo.location" : {
"lat" : 40,
"lon" : -70
}
}
}
}
}}'
On Dec 11, 7:04 pm, tiftif atifsyed...@gmail.com wrote:
I am trying to map the geo location data of tweets but I keep getting
errors...
curl -XPUT 'http://localhost:9200/media/ '
curl -XPUT 'http://localhost:9200/media/twitter/_mapping'-d '
{
"geo" : {
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}}
'
curl -XPUT 'http://localhost:9200/media/twitter/1'-d '
{
"geo" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
}
},
"tags" : ["food", "family"],
"text" : "my favorite family restaurant"
}'
curl -XGET 'http://localhost:9200/media/twitter/_search'-d
'{ "query" : {
"filtered" : {
"query" : {
"field" : { "text" : "restaurant" }
},
"filter" : {
"geo_distance" : {
"distance" : "200km",
"geo.location" : {
"lat" : 40,
"lon" : -70
}
}
}
}
}}'
I get an exception that contains: "failed to find geo_point field
[geo.location]];"
What am I doing wrong?
kimchy
(Shay Banon)
December 12, 2011, 12:56pm
3
Yes, thats the way to do it (sorry for the late response...)
On Mon, Dec 12, 2011 at 2:48 AM, tiftif atifsyedali@gmail.com wrote:
Okay, I think I figured out what I was doing wrong. I guess I need to
have a single root element that should probably be the same name as
the type itself.
Here's what works:
curl -XDELETE 'http://localhost:9200/media '
curl -XPUT 'http://localhost:9200/media/ '
curl -XPUT 'http://localhost:9200/media/twitter/_mapping ' -d '
{
"twitter" : {
"properties" : {
"geo" : {
"type" : "object",
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}
}
}
}
'
curl -XPUT 'http://localhost:9200/media/twitter/1 ' -d '
{
"twitter" : {
"geo" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
},
"tags" : ["food", "family"],
"text" : "my favorite family restaurant"
}
}
}'
curl -XGET 'http://localhost:9200/media/twitter/_search ' -d
'{ "query" : {
"filtered" : {
"query" : {
"field" : { "text" : "restaurant" }
},
"filter" : {
"geo_distance" : {
"distance" : "200km",
"geo.location" : {
"lat" : 40,
"lon" : -70
}
}
}
}
}}'
On Dec 11, 7:04 pm, tiftif atifsyed...@gmail.com wrote:
I am trying to map the geo location data of tweets but I keep getting
errors...
curl -XPUT 'http://localhost:9200/media/ '
curl -XPUT 'http://localhost:9200/media/twitter/_mapping'-d '
{
"geo" : {
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}}
'
curl -XPUT 'http://localhost:9200/media/twitter/1'-d '
{
"geo" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
}
},
"tags" : ["food", "family"],
"text" : "my favorite family restaurant"
}'
curl -XGET 'http://localhost:9200/media/twitter/_search'-d
'{ "query" : {
"filtered" : {
"query" : {
"field" : { "text" : "restaurant" }
},
"filter" : {
"geo_distance" : {
"distance" : "200km",
"geo.location" : {
"lat" : 40,
"lon" : -70
}
}
}
}
}}'
I get an exception that contains: "failed to find geo_point field
[geo.location]];"
What am I doing wrong?