SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Get all indices, verbose
  2. GET /_cat/indices?v
  3.  
  4. # Create an index with a mapping
  5. PUT index
  6. {
  7.   "mappings": {
  8.     "_doc": {
  9.         "properties": {
  10.           "field": {
  11.             "type": "boolean"
  12.           },
  13.         }
  14.     }
  15. }
  16.  
  17. # Delete an index
  18. DELETE index
  19.  
  20. # Clone an index, create the new index with the same mapping first
  21. POST _reindex
  22. {
  23.   "source": {
  24.     "index": "original"
  25.   },
  26.   "dest": {
  27.     "index": "destination"
  28.   }
  29. }
  30.  
  31. # All documents in an Index, use size if you want to get more elements
  32. GET /index/_doc/_search
  33. {
  34.   "size": 100,
  35.   "query": {
  36.     "match_all": {}
  37.   }
  38. }
  39.  
  40. #Get a single doc
  41. GET /index/_doc/$_ID
  42.  
  43. # Single partial update
  44. POST /index/_doc/{_id}/_update
  45. { "doc": {"field": "new_value"} }
  46.  
  47. #Bulk partial update
  48. POST /index/_bulk
  49. {"update" : {"_id" : "122", "_type" : "_doc"}}
  50. {"doc" : {"field" : "new_value"}}
  51.  
  52. #Ranged query with selected fields, for dates use ISOFORMAT with Zulu ending
  53. GET /index/_search
  54. {
  55.   "_source": ["date", "name", "other_field"],
  56.   "query": {
  57.     "range": {"date": {"gte": "2019-06-15", "lte": "2019-06-28"}}}
  58. }
  59.  
  60. # Search with regexp
  61. GET /index/_doc/_search
  62. {
  63.   "query": {
  64.     "regexp": {
  65.         "field": "(.*[a-zA-Z].*)"
  66.     }
  67.   }
  68. }
  69.  
  70. #Search with Wildcard
  71. GET /index/_doc/_search
  72. {
  73.   "query": {
  74.     "wildcard": {"field": "*text*"}
  75.   }
  76. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top