-
-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathrequests.http
118 lines (108 loc) · 2.24 KB
/
requests.http
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
###
### Assuming Toshi is running on port 8080
### Create an index for some song lyrics
GET http://{{host}}:{{port}}
###
PUT http://{{host}}:{{port}}/lyrics/_create
Content-Type: application/json
[
{
"name": "lyrics",
"type": "text",
"options": {
"indexing": {
"record": "position",
"tokenizer": "default"
},
"stored": true
}
},
{
"name": "year",
"type": "i64",
"options": {
"indexed": true,
"stored": true
}
},
{
"name": "idx",
"type": "u64",
"options": {
"indexed": true,
"stored": true
}
},
{
"name": "artist",
"type": "text",
"options": {
"indexing": {
"record": "position",
"tokenizer": "default"
},
"stored": true
}
},
{
"name": "genre",
"type": "text",
"options": {
"indexing": {
"record": "position",
"tokenizer": "default"
},
"stored": true
}
},
{
"name": "song",
"type": "text",
"options": {
"indexing": {
"record": "position",
"tokenizer": "default"
},
"stored": true
}
}
]
### Get the schema summary back to see the index was created
GET {{host}}:{{port}}/lyrics/_summary?include_sizes=true
Content-Type: application/JSON
### Add a single song to the index
PUT http://{{host}}:{{port}}/lyrics/
Content-Type: application/json
{
"options": {
"commit": false
},
"document": {
"song": "he-still-loves-me-f-choir-from-fighting-temptations",
"year": 2007,
"artist": "beyonce-knowles",
"genre": "Pop",
"lyrics": "Took me a while but I'm finally here",
"idx": 23
}
}
### List the indexes
GET http://{{host}}:{{port}}/_list
Content-Type: application/json
### Force a commit if necessary at any time
GET http://{{host}}:{{port}}/lyrics/_flush
Accept: application/json
### Get that document back from the engine
GET http://{{host}}:{{port}}/lyrics/
Content-Type: application/json
### Test Term Query
POST http://{{host}}:{{port}}/lyrics/
Content-Type: application/JSON
{
"query": {
"term": {
"lyrics": "me"
}
},
"limit": 1
}