Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Setup
- ```json
- PUT /index1
- {
- "mappings": {
- "foo": {
- "properties": {
- "suggest": {
- "type": "completion"
- }
- }
- }
- }
- }
- PUT /index1/foo/1
- {
- "suggest": {
- "input": ["bar"],
- "output": "From Index 1"
- }
- }
- PUT /index2
- {
- "mappings": {
- "foo": {
- "properties": {
- "suggest": {
- "type": "completion"
- }
- }
- }
- }
- }
- PUT /index2/foo/1
- {
- "suggest": {
- "input": ["bar"],
- "output": "From Index 2"
- }
- }
- ```
- Suggest Request
- ```json
- GET /index1,index2/_search?search_type=count
- {
- "suggest": {
- "mysuggestions": {
- "text": "b",
- "completion": {
- "field": "suggest"
- }
- }
- }
- }
- ```
- Response
- ```json
- {
- "took": 3,
- "timed_out": false,
- "_shards": {
- "total": 10,
- "successful": 10,
- "failed": 0
- },
- "hits": {
- "total": 2,
- "max_score": 0,
- "hits": []
- },
- "suggest": {
- "mysuggestions": [
- {
- "text": "b",
- "offset": 0,
- "length": 1,
- "options": [
- {
- "text": "From Index 1",
- "score": 1
- },
- {
- "text": "From Index 2",
- "score": 1
- }
- ]
- }
- ]
- }
- }
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement