2013-09-10 16:10:12 -04:00
|
|
|
# Will be performed before each test as a part of the test setup
|
|
|
|
#
|
|
|
|
setup:
|
|
|
|
- do:
|
|
|
|
ping: {}
|
|
|
|
|
2013-06-22 12:57:29 -04:00
|
|
|
---
|
2013-07-25 05:02:56 -04:00
|
|
|
"Basic test":
|
2013-06-22 12:57:29 -04:00
|
|
|
- do:
|
|
|
|
indices.analyze:
|
|
|
|
text: Foo Bar
|
|
|
|
- length: { tokens: 2 }
|
2013-07-11 07:52:03 -04:00
|
|
|
- match: { tokens.0.token: foo }
|
|
|
|
- match: { tokens.1.token: bar }
|
2013-06-22 12:57:29 -04:00
|
|
|
|
|
|
|
---
|
2013-07-25 05:02:56 -04:00
|
|
|
"Tokenizer and filter":
|
2013-06-22 12:57:29 -04:00
|
|
|
- do:
|
|
|
|
indices.analyze:
|
|
|
|
filters: lowercase
|
|
|
|
text: Foo Bar
|
|
|
|
tokenizer: keyword
|
|
|
|
- length: { tokens: 1 }
|
2013-07-11 07:52:03 -04:00
|
|
|
- match: { tokens.0.token: foo bar }
|
2013-06-22 12:57:29 -04:00
|
|
|
|
|
|
|
---
|
2013-07-25 05:02:56 -04:00
|
|
|
"Index and field":
|
2013-07-25 15:18:38 -04:00
|
|
|
- do:
|
2013-07-25 04:59:14 -04:00
|
|
|
indices.create:
|
|
|
|
index: test
|
|
|
|
body:
|
|
|
|
mappings:
|
|
|
|
test:
|
|
|
|
properties:
|
|
|
|
text:
|
|
|
|
type: string
|
|
|
|
analyzer: whitespace
|
|
|
|
- do:
|
2013-09-16 14:56:12 -04:00
|
|
|
cluster.health:
|
|
|
|
wait_for_status: yellow
|
2013-07-25 04:59:14 -04:00
|
|
|
|
2013-07-25 15:18:38 -04:00
|
|
|
|
2013-06-22 12:57:29 -04:00
|
|
|
- do:
|
|
|
|
indices.analyze:
|
|
|
|
field: text
|
|
|
|
index: test
|
|
|
|
text: Foo Bar!
|
|
|
|
- length: { tokens: 2 }
|
2013-07-11 07:52:03 -04:00
|
|
|
- match: { tokens.0.token: Foo }
|
|
|
|
- match: { tokens.1.token: Bar! }
|
2015-04-02 21:51:15 -04:00
|
|
|
---
|
|
|
|
"JSON in Body":
|
|
|
|
- do:
|
|
|
|
indices.analyze:
|
|
|
|
body: { "text": "Foo Bar", "filters": ["lowercase"], "tokenizer": keyword }
|
|
|
|
- length: {tokens: 1 }
|
|
|
|
- match: { tokens.0.token: foo bar }
|
|
|
|
---
|
|
|
|
"Body params override query string":
|
|
|
|
- do:
|
|
|
|
indices.analyze:
|
|
|
|
text: Foo Bar
|
|
|
|
body: { "text": "Bar Foo", "filters": ["lowercase"], "tokenizer": keyword }
|
|
|
|
- length: {tokens: 1 }
|
|
|
|
- match: { tokens.0.token: bar foo }
|
2015-04-26 21:55:21 -04:00
|
|
|
---
|
|
|
|
"Array text":
|
|
|
|
- do:
|
|
|
|
indices.analyze:
|
|
|
|
body: { "text": ["Foo Bar", "Baz"], "filters": ["lowercase"], "tokenizer": keyword }
|
|
|
|
- length: {tokens: 2 }
|
|
|
|
- match: { tokens.0.token: foo bar }
|
|
|
|
- match: { tokens.1.token: baz }
|