OpenSearch/rest-api-spec/test/indices.analyze/10_analyze.yaml

53 lines
1.2 KiB
YAML
Raw Normal View History

2013-06-22 12:57:29 -04:00
---
"Analyze API setup":
- do:
indices.create:
index: test
body:
mappings:
test:
properties:
text:
type: string
analyzer: whitespace
---
"Analyze API text format":
- do:
indices.analyze:
format: text
text: tHE BLACK and white! AND red
- match:
2013-06-22 12:57:29 -04:00
tokens: "[black:4->9:<ALPHANUM>]\n\n4: \n[white:14->19:<ALPHANUM>]\n\n6: \n[red:25->28:<ALPHANUM>]\n"
---
"Analyze API JSON format":
- do:
indices.analyze:
text: Foo Bar
- length: { tokens: 2 }
- match: { tokens.0.token: foo }
- match: { tokens.1.token: bar }
2013-06-22 12:57:29 -04:00
---
"Analyze API JSON format - tokenizer and filter":
- do:
indices.analyze:
filters: lowercase
text: Foo Bar
tokenizer: keyword
- length: { tokens: 1 }
- match: { tokens.0.token: foo bar }
2013-06-22 12:57:29 -04:00
---
"Analyze API JSON format - index and field":
- do:
indices.analyze:
field: text
index: test
text: Foo Bar!
- length: { tokens: 2 }
- match: { tokens.0.token: Foo }
- match: { tokens.1.token: Bar! }
2013-06-22 12:57:29 -04:00