Skip to content

Commit 958186c

Browse files
add readme
Signed-off-by: bharath-techie <[email protected]>
1 parent 43b5937 commit 958186c

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
2+
## Prerequisites
3+
4+
1. Publish OpenSearch to maven local
5+
```
6+
./gradlew publishToMavenLocal
7+
```
8+
2. Publish SQL plugin to maven local
9+
```
10+
./gradlew publishToMavenLocal
11+
```
12+
3. Run opensearch with following parameters
13+
```
14+
./gradlew run --preserve-data -PremotePlugins="['org.opensearch.plugin:opensearch-job-scheduler:3.3.0.0-SNAPSHOT', 'org.opensearch.plugin:opensearch-sql-plugin:3.3.0.0-SNAPSHOT']" -PinstalledPlugins="['engine-datafusion']" --debug-jvm
15+
```
16+
17+
18+
## Steps to test indexing + search e2e
19+
20+
TODO : need to remove hardcoded index name `index-7`
21+
22+
1. Delete previous index if any
23+
```
24+
curl --location --request DELETE 'localhost:9200/index-7'
25+
```
26+
27+
2. Create index with name : `index-7`
28+
```
29+
curl --location --request PUT 'http://localhost:9200/index-7' \
30+
--header 'Content-Type: application/json' \
31+
--data-raw '{
32+
"settings": {
33+
"number_of_shards": 1,
34+
"number_of_replicas": 0,
35+
"refresh_interval": -1
36+
},
37+
"mappings": {
38+
"properties": {
39+
"message": {
40+
"type": "long"
41+
},
42+
"message2": {
43+
"type": "long"
44+
},
45+
"message3": {
46+
"type": "long"
47+
}
48+
}
49+
}
50+
}'
51+
```
52+
3. Index docs
53+
```
54+
curl --location --request POST 'http://localhost:9200/_bulk' \
55+
--header 'Content-Type: application/json' \
56+
--data-raw '{"index":{"_index":"index-7"}}
57+
{"message": 2,"message2": 3,"message3": 4}
58+
{"index":{"_index":"index-7"}}
59+
{"message": 3,"message2": 4,"message3": 5}
60+
'
61+
```
62+
4. Refresh the index
63+
```
64+
curl localhost:9200/index-7/_refresh
65+
```
66+
5. Query
67+
```
68+
curl --location --request POST 'http://localhost:9200/_plugins/_ppl' \
69+
--header 'Content-Type: application/json' \
70+
--data-raw '{
71+
"query": "source=index-7 | stats count(), min(message) as min, max(message2) as max"
72+
}'
73+
```

0 commit comments

Comments
 (0)