Skip to content
Agustí Sánchez edited this page Sep 21, 2015 · 3 revisions

http://www.elastic.co/guide/en/elasticsearch/reference/1.x/query-dsl-geo-distance-filter.html

http://www.elasticsearchtutorial.com/spatial-search-tutorial.html

http://www.quora.com/Why-should-I-NOT-use-ElasticSearch-as-my-primary-datastore

Simple ping

curl -w "\n" -XGET "http://localhost:9200"
{
  "ok" : true,
  "status" : 200,
  "name" : "Growing Man",
  "version" : {
    "number" : "0.90.3",
    "build_hash" : "5c38d6076448b899d758f29443329571e2522410",
    "build_timestamp" : "2013-08-06T13:18:31Z",
    "build_snapshot" : false,
    "lucene_version" : "4.4"
  },
  "tagline" : "You Know, for Search"
}

Status

curl -w "\n" -XGET "http://localhost:9200/_status?pretty=true"
{
  "ok" : true,
  "_shards" : {
    "total" : 130,
    "successful" : 63,
    "failed" : 0
  },
  "indices" : {
    "1003" : {
      "index" : {
        "primary_size" : "133kb",
        "primary_size_in_bytes" : 136285,
        "size" : "133kb",
        "size_in_bytes" : 136285
      },
      "translog" : {
        "operations" : 0
      },
      "docs" : {
        "num_docs" : 32,
        "max_doc" : 32,
        "deleted_docs" : 0
      },
      ...
    }
    ...
  }
  ...
}

List indices

curl -w "\n" -XGET "http://localhost:9200/_aliases?pretty=true"
{
  "1003" : {
    "aliases" : { }
  },
  "int.refind" : {
    "aliases" : { }
  },
  "1002" : {
    "aliases" : { }
  },
  "testtenant" : {
    "aliases" : { }
  },

List document types

curl -w "\n" -XGET "http://localhost:9200/int.refind/_mapping?pretty=true"
curl -w "\n" -XGET "http://localhost:9200/int.refind/_mapping/location?pretty=true"
curl -w "\n" -XGET "http://localhost:9200//_mapping?type=location&pretty=true"
{
  {
    "location" : {
      "properties" : {
        "createdDate" : {
          "type" : "date",
          "format" : "dateOptionalTime"
        },
        "geometry" : {
          "properties" : {
            "coordinates" : {
              "type" : "geo_point",
              "lat_lon" : true
            },
            "type" : {
              "type" : "string"
            }
          }
        },
        "id" : {
          "type" : "long"
        },
        "images" : {
          "properties" : {
            "description" : {

Search

curl -w "\n" -XGET "http://localhost:9200/int.refind/_search?pretty=true"
curl -w "\n" -XGET "http://localhost:9200/int.refind/_search?pretty=true" -d\
'{
    "query": {
      "field" : {
        "properties.RoadAccess" : "Main Road"
    }
  }
}'
Clone this wiki locally