I've been trying to index geo data but even after following the
my data looks like
{"coordinates":[[[87.2779545572,26.4571324637],[87.2781064548,26.4579406195],[87.2782446134,26.4587874038],[87.2783030644,26.4591965219],[87.27830437,26.4592438567],[87.2783349474,26.4594676809],[87.2783562029,26.4597388392],[87.2783615164,26.4601146542],[87.2783682274,26.4603249248],[87.2783130862,26.4608071736],[87.2783030643,26.4608948231],[87.2781595918,26.4617939128],[87.2779842368,26.4628547356],[87.2779782454,26.4628535209],[87.2778832752,26.4633970355],[87.2776016445,26.4651380861],[87.2773784652,26.4664605071],[87.277181855,26.4676972891],[87.2771801092,26.4676966194],[87.2771393443,26.468020753],[87.2767833204,26.470051895],[87.2767807758,26.4700510941],[87.2765648448,26.4715927325],[87.2764969453,26.4725242677],[87.2764332357,26.4732918757],[87.2763334711,26.4751307915],[87.2763891119,26.4759481186]]],"type":"MultiLineString"}
and my code looks like
bulkRequest.add(client.prepareIndex("geo_data_line", "data_line")
.setSource(jsonBuilder()
.startObject()
.field("geometry",new JSONObject(new JSONObject(s.toString()).get("geometry").toString()))
.endObject()
)
);
}
bulkRequest.get();
and I get following error
MapperParsingException[failed to parse [geometry]]; nested: ElasticsearchParseException[shape must be an object consisting of type and coordinates];
I have specified coordinates
and type
and geometry is an Object
(JSONObject is also an Object, right ?)
and my mapping is
"data_line": {
"properties": {
"geometry": {
"type": "geo_shape"
}