Set up a mapping as follows:
curl -XPUT http://localhost:9200/us_large_cities -d '
{
"mappings": {
"city": {
"properties": {
"city": {"type": "string"},
"state": {"type": "string"},
"location": {"type": "geo_point"}
}
}
}
}
'
Tried the following Pig job to write to elasticsearch.
register '/Users/davidfauth/Downloads/elasticsearch-hadoop-1.3.0.M1.jar';
define ESStorage
org.elasticsearch.hadoop.pig.ESStorage('es.resource=us_large_cities/city');
city_data = LOAD '/Users/davidfauth/jsonTest/locations.csv' USING
PigStorage('\t') AS
(city:chararray,
state:chararray,
lat:chararray,
lon:chararray);
-- ETL the data to your heart content
B = FOREACH city_data GENERATE city, state, TOTUPLE(lat, lon) AS location;
-- save the result to Elasticsearch
STORE B INTO 'us_large_cities/city' USING
org.elasticsearch.hadoop.pig.ESStorage();
Error returned is:
JAVA UDF ERROR: java.lang.StringIndexOutOfBoundsException: String index out
of range: -1
at java.lang.String.substring(String.java:1911)
at org.elasticsearch.hadoop.rest.Resource.(Resource.java:43)
thoughts/ideas?
thanks
df
--
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.