Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.85 KB | None | 0 0
  1. #!/bin/bash
  2. set -x
  3.  
  4. curl -X DELETE 'http://localhost:9200/test-foo?pretty'
  5.  
  6. curl -X PUT 'http://localhost:9200/_template/test?pretty' -d '
  7. {
  8.     "template": "test-*",
  9.     "mappings" : {
  10.                "traces" : {
  11.                     "properties": {
  12.                          "@timestamp":      {"type": "date" },
  13.                          "start_time":      {"type": "date" }
  14.                     }
  15.                }
  16.        }
  17. }'
  18.  
  19. curl -X POST 'http://localhost:9200/test-foo/traces?pretty' -d '
  20. {
  21.     "@timestamp": "2015-03-29T12:22:11.996306+0000",
  22.     "start_time": 1427631731
  23. }'
  24.  
  25. sleep 1
  26.  
  27. curl -X GET 'http://localhost:9200/test-foo/_search?pretty' -d '
  28. {
  29.     "query": {
  30.         "range": { "start_time": { "gte": "2015-03" } }
  31.     }
  32. }'
  33. # ==> no hit
  34.  
  35. curl -X GET 'http://localhost:9200/test-foo/_search?pretty' -d '
  36. {
  37.     "query": {
  38.         "range": { "@timestamp": { "gte": "2015-03" } }
  39.     }
  40. }'
  41. # ==> finds indexed doc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement