// replace with your login curl -X GET localhost:9200/ // =========== list, create, delete index curl -X GET localhost:9200/_cat/indices?v curl -X PUT localhost:9200/_customer?pretty curl -X DELETE localhost:9200/_customer?pretty // =========== add, get, delete document curl -X PUT "localhost:9200/_customer/_doc/1?pretty" -H 'Content-Type: application/json' -d' { "name": "John Doe" } ' curl -X GET localhost:9200/_customer/_doc/1?pretty curl -X DELETE localhost:9200/_customer/_doc/1?pretty // =========== edit operations curl -X PUT "localhost:9200/_customer/_doc/1?pretty" -H 'Content-Type: application/json' -d' { "name": "John Doe" } ' curl -X GET localhost:9200/_customer/_doc/1?pretty curl -X POST "localhost:9200/_customer/_update/1?pretty" -H 'Content-Type: application/json' -d' { "doc": { "name": "Jane Doe" } } ' curl -X GET localhost:9200/_customer/_doc/1?pretty curl -X POST "localhost:9200/_customer/_update/1?pretty" -H 'Content-Type: application/json' -d' { "doc": { "name": "Jane Doe", "age": 20 } } ' curl -X GET localhost:9200/_customer/_doc/1?pretty curl -X POST "localhost:9200/_customer/_update/1?pretty" -H 'Content-Type: application/json' -d' { "script" : "ctx._source.age += 5" } ' curl -X GET localhost:9200/_customer/_doc/1?pretty // =========== load data from a file curl -H "Content-Type: application/json" -XPOST "localhost:9200/_bank/_bulk?pretty&refresh" --data-binary "@/home/NDBI040/elastic/accounts.json" curl "localhost:9200/_cat/indices?v" // =========== search data curl -X GET "localhost:9200/_bank/_search?q=*&sort=account_number:asc&pretty" curl -X GET "localhost:9200/_bank/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "match_all": {} } } ' curl -X GET "localhost:9200/_bank/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "match_all": {} }, "size": 1 } ' curl -X GET "localhost:9200/_bank/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "match_all": {} }, "from": 10, "size": 10 } ' curl -X GET "localhost:9200/_bank/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "match_all": {} }, "sort": { "balance": { "order": "desc" } } } ' curl -X GET "localhost:9200/_bank/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "match_all": {} }, "_source": ["account_number", "balance"] } ' curl -X GET "localhost:9200/_bank/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "match": { "account_number": 20 } } } ' curl -X GET "localhost:9200/_bank/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "match": { "address": "mill lane" } } } ' curl -X GET "localhost:9200/_bank/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "match_phrase": { "address": "mill lane" } } } ' curl -X GET "localhost:9200/_bank/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "bool": { "must_not": [ { "match": { "address": "mill" } }, { "match": { "address": "lane" } } ] } } } ' curl -X GET "localhost:9200/_bank/_search?pretty" -H 'Content-Type: application/json' -d' { "size": 0, "aggs": { "group_by_state": { "terms": { "field": "state.keyword" } } } } '