1. check if server is up:

    1
    
    curl 'http://localhost:9200/?pretty'
    
  2. count the number of documents in the cluster:

    1
    
    curl -XGET 'http://localhost:9200/_count?pretty' $Payload
    
  3. Index a document & put data:

    1
    
    curl -XPUT http://localhost:9200/megacorp/employee/1 -d '{"first_name":"Douglas","last_name":"Fir","age":35,"about":"I like to build cabinets","interests":["forestry"]}
    
  4. retrieving a document:

    1
    
    curl http://localhost:9200/megacorp/employee/1
    
  5. get all docs:

    1
    
    curl http://localhost:9200/megacorp/employee/_search
    
  6. search query:

    1
    
    curl http://localhost:9200/megacorp/employee/_search\?q\=last_name:Smith
    
  7. search with Query DSL:

    1
    2
    3
    4
    5
    6
    7
    
        {
            "query": {
                "match": {
                    "last_name": "Smith"
                }
            }
        }
    
  8. highlight Searches with DSL:

    1
    
    curl -H "Content-Type: application/json" http://localhost:9200/megacorp/employee/_search -d '{"query":{"match_phrase":{"about":"rock climbing"}},"highlight":{"fields":{"about":{}}}}'
    
  9. query with aggregations:

    1
    
    curl -H "Content-Type: application/json" http://localhost:9200/megacorp/employee/_search -d {"aggs":{"all_interests":{"terms":{"field":"interests"},"aggs":{"avg_age":{"avg":{"field":"age"}}}}}}
    
  10. create a document, and not overwriting an existing one: _create

  11. get mapping info:

    1
    
    http://localhost:9200/megacorp/_mapping