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

53 lines
1.2 KiB
YAML

---
"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:
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 }
---
"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 }
---
"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! }