Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. ### Create the ingest pipeline
  2.  
  3. ``` json
  4. PUT _ingest/pipeline/timestamp
  5. {
  6. "description": "Add a timestamp field to a document at the time of the ingestion",
  7. "processors": [
  8. {
  9. "set": {
  10. "field": "@timestamp",
  11. "value": "{{_ingest.timestamp}}"
  12. }
  13. }
  14. ]
  15. }
  16. ```
  17.  
  18. ### Create a index / document using the pipeline
  19.  
  20. ```
  21. POST auto_timestamp/_doc?pipeline=timestamp
  22. {
  23. "msg": "Timestamp auto-generation"
  24. }
  25. ```
  26.  
  27. ### Search the created document
  28.  
  29. ```
  30. GET auto_timestamp/_search
  31. ```
  32.  
  33. ### Result
  34.  
  35. ```
  36. "hits" : [
  37. {
  38. "_index" : "auto_timestamp",
  39. "_type" : "_doc",
  40. "_id" : "uqNXJGoBvxBjcKDft4xM",
  41. "_score" : 1.0,
  42. "_source" : {
  43. "msg" : "Check out the automated Timestamp generation!",
  44. "@timestamp" : "2019-04-16T04:11:29.484Z"
  45. }
  46. }
  47. ]
  48. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement