Elasticsearch exceptions while trying to update geoshape field

Hi
I have been getting the following elasticsearch exception when i try to update a geo_shape field from circle to polygon using java high level rest client. Can someone please help?

{"error":{"root_cause":[{"type":"parse_exception","reason":"field [radius] is supported for [CIRCLE] only"}],"type":"mapper_parsing_exception","reason":"failed to parse [geometry]","caused_by":{"type":"parse_exception","reason":"field [radius] is supported for [CIRCLE] only"}},"status":400}
		at org.elasticsearch.client.RestClient$1.completed(RestClient.java:357) ~[elasticsearch-rest-client-6.1.2.jar:6.1.2]
		at org.elasticsearch.client.RestClient$1.completed(RestClient.java:346) ~[elasticsearch-rest-client-6.1.2.jar:6.1.2]
		at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122) ~[httpcore-4.4.11.jar:4.4.11]
		at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:181) ~[httpasyncclient-4.1.4.jar:4.1.4]
		at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448) ~[httpcore-nio-4.4.11.jar:4.4.11]
		at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338) ~[httpcore-nio-4.4.11.jar:4.4.11]
		at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265) ~[httpcore-nio-4.4.11.jar:4.4.11]
		at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) ~[httpasyncclient-4.1.4.jar:4.1.4]
		at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) ~[httpasyncclient-4.1.4.jar:4.1.4]
		at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114) ~[httpcore-nio-4.4.11.jar:4.4.11]
		at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) ~[httpcore-nio-4.4.11.jar:4.4.11]
		at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) ~[httpcore-nio-4.4.11.jar:4.4.11]
		at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) ~[httpcore-nio-4.4.11.jar:4.4.11]
		at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) ~[httpcore-nio-4.4.11.jar:4.4.11]
		at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) ~[httpcore-nio-4.4.11.jar:4.4.11]
		at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591) ~[httpcore-nio-4.4.11.jar:4.4.11]
		... 1 common frames omitted
Caused by: org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=parse_exception, reason=field [radius] is supported for [CIRCLE] only]
	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:490) ~[elasticsearch-6.1.2.jar:6.1.2]
	at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:406) ~[elasticsearch-6.1.2.jar:6.1.2]
	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:435) ~[elasticsearch-6.1.2.jar:6.1.2]
	at org.elasticsearch.ElasticsearchException.failureFromXContent(ElasticsearchException.java:594) ~[elasticsearch-6.1.2.jar:6.1.2]
	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:169) ~[elasticsearch-6.1.2.jar:6.1.2]
	... 112 common frames omitted

Here's my mapping

{
  "bigpolygons": {
    "mappings": {
      "bigpolygon": {
        "properties": {
          "geometry": {
            "type": "geo_shape"
          },
          "id": {
            "type": "keyword"
          },
          "type": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
      }
    }
  }

Elasticsearch version - 6.1.2
Java high level rest client version - 6.1.2
Java version - 12

Could you share the type of shape you are trying to index? It seems there is something off in the definition.

Existing:

{
  "id": "28f28e33-c252-401e-8c58-790371e8a72f",
  "geometry": {
    "type": "Circle",
    "coordinates": [
      -80.16079149891036,
      26.1555738384032
    ],
    "radius": "1640.35ft"
  },
  "type": "plan"
}

I am trying to update this using update API mentioned in https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.1/java-rest-high-document-update.html

update json

{
  "id": "28f28e33-c252-401e-8c58-790371e8a72f",
  "geometry": {
    "coordinates": [
      [
        [
          -71.0709988886577,
          42.43068071340372
        ],
        [
          -71.06271904724004,
          42.43507640849123
        ],
        [
          -71.05298660206532,
          42.42842914043001
        ],
        [
          -71.06359060949553,
          42.42499801656919
        ],
        [
          -71.0709988886577,
          42.43068071340372
        ]
      ]
    ],
    "type": "Polygon"
  },
  "type": "plan"
}

It would help if you can share is the code where you are performing the update. From the Kibana console seems to work fine.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.