Skip to content

Commit 8f73be1

Browse files
authored
Update README.MD
1 parent 9945f4b commit 8f73be1

File tree

1 file changed

+57
-44
lines changed

1 file changed

+57
-44
lines changed

README.MD

Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@
44
[![License Apache2](https://img.shields.io/hexpm/l/plug.svg)](http://www.apache.org/licenses/LICENSE-2.0)
55
[![Maven Central](https://img.shields.io/maven-central/v/com.datastax.astra/astra-db-java)](https://search.maven.org/artifact/com.datastax.astra/astra-db-java)
66

7-
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=clun_astra-db-java&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=clun_db-java)
8-
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=clun_astra-db-java&metric=sqale_rating)](https://sonarcloud.io/summary/overall?id=clun_astra-db-java)
9-
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=clun_astra-db-java&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=clun_astra-db-java)
10-
11-
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=clun_astra-db-java&metric=bugs)](https://sonarcloud.io/summary/new_code?id=clun_astra-db-java)
12-
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=clun_astra-db-java&metric=vulnerabilities)](https://sonarcloud.io/summary/overall?id=clun_astra-db-java)
13-
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=clun_astra-db-java&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=clun_astra-db-java)
14-
15-
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=clun_astra-db-java&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=clun_astra-db-java)
16-
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=clun_astra-db-java&metric=coverage)](https://sonarcloud.io/summary/new_code?id=clun_astra-db-java)
17-
18-
197
This client library provides a simplified way to interact with Data API for AstraDB or local instances. For detailed documentation, each operation comes with a detailed description and examples.
208

219
- [`astra-db-ts`](https://github.com/datastax/astra-db-ts) is the equivalent for typescript
@@ -37,7 +25,7 @@ You can build it locally and install it in your local repository.
3725
3. [QuickStart with Local Instances]()
3826
1. [Start Data Api with DSE](#31-start-data-api-with-dse)
3927
2. [Start Data Api with HCD](#32-start-data-api-with-hcd)
40-
3. [Datq Api Information](#33-datq-api-information)
28+
3. [Data Api Information](#33-datq-api-information)
4129
4. [Using Java client with Local Instance](#34-using-java-client-with-local-instance)
4230
4. [What's Next](#4-whats-next)
4331

@@ -184,36 +172,36 @@ public class GettingStarted {
184172

185173
## 3. QuickStart with Local Instances
186174

187-
### 3.1. Start Data Api with DSE
188-
189-
- Start the 2 containers with the following command:
190-
191-
```console
192-
docker-compose up -d
193-
```
175+
> Prequisite. You need HCD, DSE or CASSANDRA running on your machine and listening on `9042`. One good way is to run HCD as a docker image following the instruction [here](https://github.com/stargate/data-api/tree/main/docker-compose).
194176
195-
### 3.2. Start Data Api with HCD
177+
### 3.1 Start Data API
196178

179+
- Clone the repository
197180
```
198-
docker-compose -f docker-compose-hcd.yml up -d
181+
git clone git@github.com:stargate/data-api.git
199182
```
200183

201-
- Check the status of the containers with the following command:
184+
- Access the folder and start the data API. Note that we position cassandra endpoint to `localhost` and datacenter to `dc1`.
202185

203-
```console
204-
docker-compose ps
186+
```
187+
cd data-api
188+
189+
STARGATE_DATA_STORE_SAI_ENABLED=true \
190+
STARGATE_DATA_STORE_VECTOR_SEARCH_ENABLED=true \
191+
STARGATE_JSONAPI_OPERATIONS_VECTORIZE_ENABLED=true \
192+
STARGATE_DATA_STORE_IGNORE_BRIDGE=true \
193+
STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_LOCAL_DATACENTER=dc1 \
194+
STARGATE_JSONAPI_OPERATIONS_DATABASE_CONFIG_CASSANDRA_END_POINTS=localhost \
195+
QUARKUS_HTTP_ACCESS_LOG_ENABLED=FALSE \
196+
QUARKUS_LOG_LEVEL=INFO \
197+
JAVA_MAX_MEM_RATIO=75 \
198+
JAVA_INITIAL_MEM_RATIO=50 \
199+
GC_CONTAINER_OPTIONS="-XX:+UseG1GC" \
200+
JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" \
201+
mvn quarkus:dev -Dstargate.data-store.ignore-bridge=true -Dstargate.jsonapi.operations.vectorize-enabled=true -Dstargate.jsonapi.operations.database-config.local-datacenter=dc1 -Dquarkus.log.console.darken=2 -Dstargate.feature.flags.tables=true -Dstargate.jsonapi.operations.extend-error=true -Dstargate.feature.flags.reranking=true
205202
```
206203

207-
### 3.3. Datq Api Information
208-
209-
> _Output_
210-
> ```console
211-
> NAME IMAGE COMMAND
212-
> astra-db-java-coordinator-1 stargateio/coordinator-dse-next:v2.1.0-BETA-9 "./starctl"
213-
> astra-db-java-jsonapi-1 stargateio/jsonapi:v1.0.6
214-
> ```
215-
216-
- Here are the information to connect to the local instance:
204+
- To check the Data API is running
217205

218206
| Field | Description |
219207
|--------------------------------------------|-----------------------------------------------------------------------------------------|
@@ -231,21 +219,46 @@ docker-compose ps
231219
| **Data API Endpoint** | `/v1/{namespace}` | Interact with collections of a namespace |
232220
| **Token Header Key** | `/v1/{namespace}/{collection}` |Interact with documents of a collection |
233221

234-
- Sample curl to create a namespace:
222+
- Create a keyspace call `default_keyspace`
235223

236224
```console
237-
curl -X 'POST' \
238-
'http://localhost:8181/v1' \
239-
-H 'accept: application/json' \
240-
-H 'Token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' \
241-
-H 'Content-Type: application/json' \
242-
-d '{
243-
"createNamespace": {
244-
"name": "default_keyspace"
225+
curl --location 'http://localhost:8181//v1' \
226+
--header 'token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' \
227+
--header 'Content-Type: application/json' \
228+
--data '{"createKeyspace":{"name":"default_keyspace"}}'
229+
```
230+
231+
- Create a collection with CURL
232+
233+
```
234+
curl --location 'http://localhost:8181//v1/default_keyspace' \
235+
--header 'token: Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh' \
236+
--header 'Content-Type: application/json' \
237+
--data '{
238+
"createCollection": {
239+
"name": "collection_jeremy",
240+
"options": {
241+
"indexing": {
242+
"allow": [
243+
"property1",
244+
"property2"
245+
]
246+
},
247+
"vector": {
248+
"dimension": 5,
249+
"metric": "cosine"
250+
}
251+
}
245252
}
246253
}'
247254
```
248255

256+
257+
258+
259+
260+
261+
249262
### 3.4. Using Java client with Local Instance
250263

251264
```java

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy