summaryrefslogtreecommitdiff
path: root/rest-api-spec/test/indices.analyze/10_analyze.yaml
blob: d3af1e30665778e5abba6bb8a846d1b159174694 (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
# Will be performed before each test as a part of the test setup
#
setup:
  - do:
      ping: {}

---
"Basic test":
    - do:
        indices.analyze:
          text: Foo Bar
    - length: { tokens: 2 }
    - match:     { tokens.0.token: foo }
    - match:     { tokens.1.token: bar }

---
"Tokenizer and filter":
    - do:
        indices.analyze:
          filters:      lowercase
          text:         Foo Bar
          tokenizer:    keyword
    - length: { tokens: 1 }
    - match:     { tokens.0.token: foo bar }

---
"Index and field":
    - do:
        indices.create:
          index: test
          body:
            mappings:
              test:
                properties:
                  text:
                    type:     string
                    analyzer: whitespace
    - do:
        cluster.health:
          wait_for_status: yellow


    - do:
        indices.analyze:
          field: text
          index: test
          text: Foo Bar!
    - length: { tokens: 2 }
    - match:     { tokens.0.token: Foo }
    - match:     { tokens.1.token: Bar! }