summaryrefslogtreecommitdiff
path: root/rest-api-spec/test/update/70_timestamp.yaml
blob: 368f750425f421df6841e701bd7fb77051b67e28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
"Timestamp":

 - do:
      indices.create:
          index:    test_1
          body:
              mappings:
                test:
                  _timestamp:
                    enabled:  1
                    store:    yes
 - do:
      cluster.health:
          wait_for_status: yellow

# blank timestamp
 - do:
      update:
          index:     test_1
          type:      test
          id:        1
          body:
            doc:        { foo: baz }
            upsert:     { foo: bar }

 - do:
      get:
          index:   test_1
          type:    test
          id:      1
          fields:  _timestamp

 - is_true: fields._timestamp

# milliseconds since epoch

 - do:
      update:
          index:     test_1
          type:      test
          id:        1
          body:
            doc:        { foo: baz }
            upsert:     { foo: bar }
          timestamp: 1372011280000

 - do:
      get:
          index:   test_1
          type:    test
          id:      1
          fields:  _timestamp

 - match: { fields._timestamp: 1372011280000 }

# date format

 - do:
      update:
          index:     test_1
          type:      test
          id:        1
          body:
            doc:        { foo: baz }
            upsert:     { foo: bar }
          timestamp: 2013-06-23T18:14:40

 - do:
      get:
          index:   test_1
          type:    test
          id:      1
          fields:  _timestamp

 - match: { fields._timestamp: 1372011280000 }