zoukankan      html  css  js  c++  java
  • elasticsearch地理空间操作简单操作

    创建索引库

    PUT http://localhost:9200/geo
    {
      "mappings": {
        "poi": {
          "properties": {
            "name": {
              "type": "string"
            },
            "location": {
              "type": "geo_shape"
            }
          }
        }
      }
    }

    录入数据

    curl -POST http://localhost:9200/geo/poi
    {
    	"name": "北京华通康源科技有限公司",
    	"location": {
    		"type": "point",
    		"coordinates": [116.65032,
    		40.33047]
    	}
    }
    curl -POST http://localhost:9200/geo/poi
    {
    	"name": "北京城磊鑫伟业工贸有限公司",
    	"location": {
    		"type": "point",
    		"coordinates": [117.08914,
    		40.59023]
    	}
    }
    curl -POST http://localhost:9200/geo/poi
    {
    	"name": "null",
    	"location": {
    		"type": "point",
    		"coordinates": [115.69617,
    		39.97179]
    	}
    }
    

      

    范围查询

    {
        "query":{
            "bool": {
                "must": {
                    "match_all": {}
                },
                "filter": {
                    "geo_shape": {
                        "location": {
                            "shape": {
                                "type": "envelope",
                                "coordinates" : [[111.0, 29.0], [117.0, 40.0]]
                            },
                            "relation": "within"
                        }
                    }
                }
            }
        }
    }  
  • 相关阅读:
    第 9 章
    第 8 章
    第 7 章
    第 6 章
    第 5 章
    第 4 章
    跳舞链解数独
    minic 类型声明与变量定义句型处理
    minic 动作句型处理
    minic 符号表
  • 原文地址:https://www.cnblogs.com/lilei2blog/p/7799421.html
Copyright © 2011-2022 走看看