Skip to content

Instantly share code, notes, and snippets.

@DaveCTurner
Last active Apr 9, 2019
Embed
What would you like to do?
Shape with hole
# see https://discuss.elastic.co/t/failed-to-create-valid-geo-shape/175975
# ========================================
# Request:
PUT /index
{
"mappings": {
"doc": {
"properties": {
"parcel": {
"type": "geo_shape"
}
}
}
}
}
# ----------------------------------------
# Response:
# 200 OK
# {
# "shards_acknowledged": true,
# "acknowledged": true,
# "index": "index"
# }
# ========================================
# Request:
PUT /index/doc/1
{
"parcel": {
"coordinates": [
[
[
-116.96938484446626,
32.657287303780286
],
[
-116.96965590466098,
32.65769347876227
],
[
-116.96968135808686,
32.6576270315712
],
[
-116.9696296695897,
32.65755262998358
],
[
-116.96958127691761,
32.65749789091981
],
[
-116.96957440818564,
32.65748867799296
],
[
-116.96956934986578,
32.657478661509074
],
[
-116.96956622948879,
32.657468094004884
],
[
-116.96956512572433,
32.65745724190901
],
[
-116.96956606714967,
32.657446269236075
],
[
-116.96956906760627,
32.6574355644998
],
[
-116.9695740501034,
32.65742540237828
],
[
-116.969580886792,
32.657416043627286
],
[
-116.96958940224481,
32.65740772838791
],
[
-116.96959937795938,
32.65740067002504
],
[
-116.96961055796365,
32.65739504965278
],
[
-116.96962265538367,
32.65739101148703
],
[
-116.96963941117102,
32.65738669475593
],
[
-116.96968929311828,
32.657380266168204
],
[
-116.96971421919122,
32.65737107267142
],
[
-116.96974025096051,
32.657364424338446
],
[
-116.96976702669309,
32.65736041355325
],
[
-116.96979610325567,
32.657360133811345
],
[
-116.96979604847199,
32.65738964993994
],
[
-116.96980892900375,
32.657405741211996
],
[
-116.96982254848434,
32.65743912428268
],
[
-116.96982440712573,
32.65757530006893
],
[
-116.96980091875615,
32.65757556917019
],
[
-116.96980231781737,
32.657671757416445
],
[
-116.9697584569099,
32.65767190361854
],
[
-116.96974569627933,
32.657672831284636
],
[
-116.96973324810837,
32.65767538023773
],
[
-116.96972139855602,
32.65767949188214
],
[
-116.96971042002004,
32.65768507169981
],
[
-116.96965590466098,
32.65769347876227
],
[
-116.96990213306911,
32.65867026497289
],
[
-116.97006251074156,
32.65857074329798
],
[
-116.97005268730561,
32.65855941927579
],
[
-116.97003450060356,
32.6585345821853
],
[
-116.97002111542614,
32.658507649697114
],
[
-116.97001285932787,
32.65847928089662
],
[
-116.9700099343441,
32.65845017001777
],
[
-116.97001097289177,
32.65835570181368
],
[
-116.97000715900516,
32.65831706419927
],
[
-116.9699964004178,
32.65827937538843
],
[
-116.96997895057578,
32.65824352320803
],
[
-116.96996360978483,
32.658217810190656
],
[
-116.96995412719613,
32.65819832535261
],
[
-116.96994828258882,
32.65817784218089
],
[
-116.96994621374785,
32.658156843568825
],
[
-116.96994749057211,
32.658138590985246
],
[
-116.96995162570506,
32.65812064419561
],
[
-116.96996504123173,
32.65808733706838
],
[
-116.9699691677423,
32.65807079841303
],
[
-116.9699708627772,
32.65805395631389
],
[
-116.96997245721279,
32.657996138448745
],
[
-116.96997395540546,
32.65798353768613
],
[
-116.96997771710345,
32.65797127964815
],
[
-116.96998365356143,
32.65795965352442
],
[
-116.96999162472632,
32.65794893359554
],
[
-116.97000144254328,
32.65793937276407
],
[
-116.97001287539223,
32.65793119658679
],
[
-116.97002565355174,
32.65792459795438
],
[
-116.97003947556234,
32.657919732540094
],
[
-116.97007491381149,
32.65790988387757
],
[
-116.97013168236613,
32.65789034801523
],
[
-116.97018474056775,
32.657864400922804
],
[
-116.97024731836858,
32.657828722926105
],
[
-116.97020373733335,
32.65777402469739
],
[
-116.97024107997201,
32.65774911106885
],
[
-116.97027361924266,
32.65771977010137
],
[
-116.97030062916816,
32.6576866564197
],
[
-116.97032150713939,
32.65765050882081
],
[
-116.97033578735719,
32.657612133789556
],
[
-116.97034315122659,
32.65757238750681
],
[
-116.97034343446302,
32.657532156744935
],
[
-116.97033663075669,
32.657492339084676
],
[
-116.97032289191274,
32.65745382288943
],
[
-116.97030252446456,
32.65741746748388
],
[
-116.97027598283205,
32.65738408398364
],
[
-116.9702452280353,
32.65735551282378
],
[
-116.9702099567526,
32.6573309585366
],
[
-116.97017089494474,
32.65731092650107
],
[
-116.97012884658778,
32.657295829018686
],
[
-116.97008467712605,
32.65728597682711
],
[
-116.9700392956597,
32.65728157270474
],
[
-116.96999363623335,
32.657282707297725
],
[
-116.9698516329254,
32.657294901661395
],
[
-116.96980576339504,
32.657297534863744
],
[
-116.96975978838934,
32.657297573600744
],
[
-116.96938484446626,
32.657287303780286
]
]
],
"type": "Polygon"
}
}
# ----------------------------------------
# Response:
# 400 Bad Request
# {
# "status": 400,
# "error": {
# "caused_by": {
# "reason": "at least 4 polygon points required",
# "type": "illegal_argument_exception"
# },
# "reason": "failed to parse field [parcel] of type [geo_shape]",
# "root_cause": [
# {
# "reason": "failed to parse field [parcel] of type [geo_shape]",
# "type": "mapper_parsing_exception"
# }
# ],
# "type": "mapper_parsing_exception"
# }
# }
# ========================================
# Request:
PUT /index/doc/2
{
"parcel": {
"coordinates": [
[
[
-116.96938484446626,
32.657287303780286
],
[
-116.96965590466098,
32.65769347876227
],
[
-116.96990213306911,
32.65867026497289
],
[
-116.97006251074156,
32.65857074329798
],
[
-116.97005268730561,
32.65855941927579
],
[
-116.97003450060356,
32.6585345821853
],
[
-116.97002111542614,
32.658507649697114
],
[
-116.97001285932787,
32.65847928089662
],
[
-116.9700099343441,
32.65845017001777
],
[
-116.97001097289177,
32.65835570181368
],
[
-116.97000715900516,
32.65831706419927
],
[
-116.9699964004178,
32.65827937538843
],
[
-116.96997895057578,
32.65824352320803
],
[
-116.96996360978483,
32.658217810190656
],
[
-116.96995412719613,
32.65819832535261
],
[
-116.96994828258882,
32.65817784218089
],
[
-116.96994621374785,
32.658156843568825
],
[
-116.96994749057211,
32.658138590985246
],
[
-116.96995162570506,
32.65812064419561
],
[
-116.96996504123173,
32.65808733706838
],
[
-116.9699691677423,
32.65807079841303
],
[
-116.9699708627772,
32.65805395631389
],
[
-116.96997245721279,
32.657996138448745
],
[
-116.96997395540546,
32.65798353768613
],
[
-116.96997771710345,
32.65797127964815
],
[
-116.96998365356143,
32.65795965352442
],
[
-116.96999162472632,
32.65794893359554
],
[
-116.97000144254328,
32.65793937276407
],
[
-116.97001287539223,
32.65793119658679
],
[
-116.97002565355174,
32.65792459795438
],
[
-116.97003947556234,
32.657919732540094
],
[
-116.97007491381149,
32.65790988387757
],
[
-116.97013168236613,
32.65789034801523
],
[
-116.97018474056775,
32.657864400922804
],
[
-116.97024731836858,
32.657828722926105
],
[
-116.97020373733335,
32.65777402469739
],
[
-116.97024107997201,
32.65774911106885
],
[
-116.97027361924266,
32.65771977010137
],
[
-116.97030062916816,
32.6576866564197
],
[
-116.97032150713939,
32.65765050882081
],
[
-116.97033578735719,
32.657612133789556
],
[
-116.97034315122659,
32.65757238750681
],
[
-116.97034343446302,
32.657532156744935
],
[
-116.97033663075669,
32.657492339084676
],
[
-116.97032289191274,
32.65745382288943
],
[
-116.97030252446456,
32.65741746748388
],
[
-116.97027598283205,
32.65738408398364
],
[
-116.9702452280353,
32.65735551282378
],
[
-116.9702099567526,
32.6573309585366
],
[
-116.97017089494474,
32.65731092650107
],
[
-116.97012884658778,
32.657295829018686
],
[
-116.97008467712605,
32.65728597682711
],
[
-116.9700392956597,
32.65728157270474
],
[
-116.96999363623335,
32.657282707297725
],
[
-116.9698516329254,
32.657294901661395
],
[
-116.96980576339504,
32.657297534863744
],
[
-116.96975978838934,
32.657297573600744
],
[
-116.96938484446626,
32.657287303780286
]
],
[
[
-116.96965590466098,
32.65769347876227
],
[
-116.96968135808686,
32.6576270315712
],
[
-116.9696296695897,
32.65755262998358
],
[
-116.96958127691761,
32.65749789091981
],
[
-116.96957440818564,
32.65748867799296
],
[
-116.96956934986578,
32.657478661509074
],
[
-116.96956622948879,
32.657468094004884
],
[
-116.96956512572433,
32.65745724190901
],
[
-116.96956606714967,
32.657446269236075
],
[
-116.96956906760627,
32.6574355644998
],
[
-116.9695740501034,
32.65742540237828
],
[
-116.969580886792,
32.657416043627286
],
[
-116.96958940224481,
32.65740772838791
],
[
-116.96959937795938,
32.65740067002504
],
[
-116.96961055796365,
32.65739504965278
],
[
-116.96962265538367,
32.65739101148703
],
[
-116.96963941117102,
32.65738669475593
],
[
-116.96968929311828,
32.657380266168204
],
[
-116.96971421919122,
32.65737107267142
],
[
-116.96974025096051,
32.657364424338446
],
[
-116.96976702669309,
32.65736041355325
],
[
-116.96979610325567,
32.657360133811345
],
[
-116.96979604847199,
32.65738964993994
],
[
-116.96980892900375,
32.657405741211996
],
[
-116.96982254848434,
32.65743912428268
],
[
-116.96982440712573,
32.65757530006893
],
[
-116.96980091875615,
32.65757556917019
],
[
-116.96980231781737,
32.657671757416445
],
[
-116.9697584569099,
32.65767190361854
],
[
-116.96974569627933,
32.657672831284636
],
[
-116.96973324810837,
32.65767538023773
],
[
-116.96972139855602,
32.65767949188214
],
[
-116.96971042002004,
32.65768507169981
],
[
-116.96965590466098,
32.65769347876227
]
]
],
"type": "Polygon"
}
}
# ----------------------------------------
# Response:
# 201 Created
# {
# "_type": "doc",
# "_primary_term": 1,
# "_id": "2",
# "_shards": {
# "successful": 1,
# "total": 2,
# "failed": 0
# },
# "_index": "index",
# "result": "created",
# "_version": 1,
# "_seq_no": 0
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment