Skip to content

Instantly share code, notes, and snippets.

@zumo64
Created June 9, 2016 07:54
Show Gist options
  • Save zumo64/c8a9107bc87b688b1783878c734a2b64 to your computer and use it in GitHub Desktop.
Save zumo64/c8a9107bc87b688b1783878c734a2b64 to your computer and use it in GitHub Desktop.
PUT issue
{
"settings": {
"number_of_replicas": 0,
"number_of_shards": 1
},
"mappings": {
"typ": {
"properties": {
"name": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"websiteUrl": {
"type": "string"
},
"imageDescription": {
"type": "string"
},
"imageUrl": {
"type": "string"
},
"polygon":{
"type": "geo_shape"
}
}
}
}
}
POST /issue/typ/1
{
"name": "Lewes",
"title": "Lewes",
"description": "Lewes in East Sussex",
"websiteUrl": "http://localhost/locations/sheffield",
"imageDescription": "A Location page image description",
"imageUrl": "http://localhost/image/123456789",
"sourceId": "400",
"type": "LOCATION_PAGE"
}
POST /issue/typ/2
{
"name": "UK",
"title": "UK",
"description": "UK",
"websiteUrl": "http://localhost/locations/sheffield",
"imageDescription": "A Location page image description",
"imageUrl": "http://localhost/image/123456789",
"sourceId": "500",
"polygon": {
"coordinates": [
[
[
-5.09765625,
59.97700549
],
[
-12.61230469,
51.91716759
],
[
-7.25097656,
48.60385761
],
[
4.83398438,
50.54136297
],
[
-5.09765625,
59.97700549
]
]
],
"type": "polygon"
},
"area": 1500,
"type": "LOCATION_PAGE"
}
POST /issue/typ/3
{
"name": "South East",
"title": "South East",
"description": "South East of the UK",
"websiteUrl": "http://localhost/locations/sheffield",
"imageDescription": "A Location page image description",
"imageUrl": "http://localhost/image/123456789",
"sourceId": "200",
"polygon": {
"coordinates": [
[
[
-0.547423,
50.803331
],
[
1.394114,
50.759889
],
[
1.319208,
51.545299
],
[
-0.525747,
51.512989
],
[
-0.547423,
50.803331
]
]
],
"type": "polygon"
},
"area": 1000,
"type": "LOCATION_PAGE"
}
POST /issue/typ/4
{
"name": "East Sussex",
"title": "East Sussex",
"description": "East Sussex is part of the historic county of Sussex, which has its roots in the ancient kingdom of the South Saxons",
"websiteUrl": "http://localhost/locations/sheffield",
"imageDescription": "A Location page image description",
"imageUrl": "http://localhost/image/123456789",
"sourceId": "100",
"polygon": {
"coordinates": [
[
[
0.104957,
51.14675
],
[
-0.129881,
50.826991
],
[
0.24778,
50.734851
],
[
0.865761,
50.92914
],
[
0.104957,
51.14675
]
]
],
"type": "polygon"
},
"area": 100,
"type": "LOCATION_PAGE"
}
POST /issue/typ/_search
{
"size": 5,
"explain": true,
"query": {
"bool": {
"should": [
{
"match": {
"title": {
"query": "Lewes",
"type": "phrase",
"boost": 1
}
}
},
{
"match": {
"name": {
"query": "Lewes",
"type": "phrase",
"boost": 1
}
}
},
{
"geo_shape": {
"polygon": {
"shape": {
"type": "point",
"coordinates": [
0.00878,
50.873872
]
}
}
}
}
],
"minimum_should_match": "1"
}
},
"sort": [
{
"_score": {}
},
{
"area": {
"order": "asc"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment