Created
September 23, 2013 16:30
-
-
Save jpountz/6673167 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -XDELETE localhost:9200/test?pretty | |
| echo | |
| curl -XPUT localhost:9200/test?pretty -d '{ | |
| "settings": { | |
| "analysis" : { | |
| "analyzer" : { | |
| "str_search_analyzer" : { | |
| "tokenizer" : "whitespace", | |
| "filter" : ["lowercase"] | |
| }, | |
| "str_index_analyzer" : { | |
| "tokenizer" : "whitespace", | |
| "filter" : ["lowercase", "substring"] | |
| } | |
| }, | |
| "filter" : { | |
| "substring" : { | |
| "type" : "edgeNGram", | |
| "min_gram" : 1, | |
| "max_gram" : 255 | |
| } | |
| } | |
| } | |
| }, | |
| "mappings": { | |
| "hedehusene" : { | |
| "properties" : { | |
| "geometry": { | |
| "type": "object", | |
| "properties": { | |
| "coordinates": { | |
| "type": "geo_point" | |
| } | |
| } | |
| }, | |
| "properties": { | |
| "type": "object", | |
| "properties": { | |
| "text": { | |
| "type" : "string", | |
| "search_analyzer" : "str_search_analyzer", | |
| "index_analyzer" : "str_index_analyzer" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }' | |
| curl -XPOST localhost:9200/test/hedehusene?pretty -d '{ | |
| "geometry": { | |
| "type":"Point", | |
| "coordinates": [ | |
| 12.216, | |
| 55.648 | |
| ] | |
| }, | |
| "type":"Feature", | |
| "properties": { | |
| "gid":30, | |
| "text":"Man bliver #moppet mere" | |
| } | |
| }' | |
| echo | |
| curl -XPOST localhost:9200/test/_refresh?pretty | |
| echo | |
| curl -XPOST localhost:9200/test/_search?pretty -d '{ | |
| "query": { | |
| "filtered": { | |
| "query": { | |
| "query_string": { | |
| "default_field": "text", | |
| "query": "godt", | |
| "default_operator": "AND" | |
| } | |
| }, | |
| "filter": { | |
| "geo_bounding_box": { | |
| "geometry.coordinates": { | |
| "top_left": { | |
| "lat": 40.73, | |
| "lon": -74.1 | |
| }, | |
| "bottom_right": { | |
| "lat": 40.717, | |
| "lon": -73.99 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }' | |
| echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment