Json needed for geo_shape indexing


(Kevin Reilly) #1

I have been trying out the geo_shape type for use in our data warehouse and can successfully index and search. What I can't figure out is how I can programatically generate the needed Json in Java. Any ideas?

What I currently get.

{
  "name":"N1",
  "id":1000000,
  "location" : {
    "type" : "polygon",
    "coordinates" : [
	  [{"latlon":[100.0,0.0]},{"latlon":[101.0,0.0]},...
    ]
  }
}

What I want.

{
  "id" : 1000000,
  "name" : "N1",
  "location" : {
    "type" : "polygon",
    "coordinates" : [
        [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]
    ]
}

(Kevin Reilly) #2

The @JsonValue annotation does the trick!

Perhaps I was to quick on the draw with the post.


(system) #3