Skip to content

Commit

Permalink
Add bydbctl and web-ui interacting guide. (#507)
Browse files Browse the repository at this point in the history
* Add bydbctl and web-ui interacting guide.
  • Loading branch information
wankai123 authored Aug 8, 2024
1 parent f354d0a commit a20d7ae
Show file tree
Hide file tree
Showing 27 changed files with 830 additions and 190 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Release Notes.
- Introduce new doc menu structure.
- Add installation on Docker and Kubernetes.
- Add quick-start guide.
- Add web-ui interacting guide.
- Add bydbctl interacting guide.

### Chores

Expand Down
2 changes: 1 addition & 1 deletion docs/concept/data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This chapter introduces BanyanDB's data models and covers the following:
* data model
* data retrieval

You can also find [examples](../crud/) of how to interact with BanyanDB using [bydbctl](../clients.md#command-line), how to create and drop groups, or how to create, read, update and drop streams/measures.
You can also find [examples](../interacting/bydbctl/schema) of how to interact with BanyanDB using [bydbctl](../interacting/bydbctl/bydbctl.md), how to create and drop groups, or how to create, read, update and drop streams/measures.

## Structure of BanyanDB

Expand Down
65 changes: 0 additions & 65 deletions docs/crud/measure/query.md

This file was deleted.

61 changes: 0 additions & 61 deletions docs/crud/stream/query.md

This file was deleted.

20 changes: 20 additions & 0 deletions docs/interacting/bydbctl/bydbctl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# bydbctl
`bydbctl` is the command line tool for interacting with BanyanDB. It is a powerful tool that can be used to create, update, read, and delete schemas. It can also be used to query data stored in streams, measures, and properties.

These are several ways to install:

* Get binaries from [download](https://skywalking.apache.org/downloads/).
* Build from [sources](https://github.com/apache/skywalking-banyandb/tree/main/bydbctl) to get latest features.

The config file named `.bydbctl.yaml` will be created in `$HOME` folder after the first CRUD command is applied.
```shell
> more ~/.bydbctl.yaml
addr: http://127.0.0.1:17913
group: ""
```

`bydbctl` leverages HTTP endpoints to retrieve data instead of gRPC.

## HTTP client

Users could select any HTTP client to access the HTTP based endpoints. The default address is `localhost:17913/api`
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# CRUD Property
# CRUD [Property](../../concept/data-model.md#properties)

CRUD operations create/update, read and delete property.

Property stores the user defined data.

[`bydbctl`](../clients.md#command-line) is the command line tool in examples.
[bydbctl](bydbctl.md) is the command line tool in examples.

## Apply (Create/Update) operation

Expand Down Expand Up @@ -76,6 +76,7 @@ tags:
str:
value: "failed"
ttl: "1h"
EOF
```

## Get operation
Expand Down Expand Up @@ -169,4 +170,4 @@ bydbctl property keepalive --lease_id 1

## API Reference

[MeasureService v1](../api-reference.md#PropertyService)
[PropertyService v1](../../api-reference.md#propertyservice)
92 changes: 92 additions & 0 deletions docs/interacting/bydbctl/query/filter-operation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Filter Operation

Filter operation is a part of the query configuration. It is used to filter the data based on the given condition for [Stream](stream.md) and [Measure](measure.md) queries.

The condition is a combination of the tag name, operation, and value.
The operation's root is Criteria which is defined in the [API Reference](../../../api-reference.md#criteria).

The following are the examples of filter operations:

## [Condition.BinaryOp](../../../api-reference.md#conditionbinaryop)

### EQ, NE, LT, GT, LE and GE
EQ, NE, LT, GT, LE and GE, only one operand should be given, i.e. one-to-one relationship.

```shell
criteria:
condition:
name: "entity_id"
op: "BINARY_OP_EQ"
value:
str:
value: "entity_1"
```

### IN and NOT_IN
HAVING and NOT_HAVING allow multi-value to be the operand such as array/vector, i.e. one-to-many relationship.

```shell
criteria:
condition:
name: "entity_id"
op: "BINARY_OP_IN"
value:
str_array:
value: ["entity_1", "entity_2", "unknown"]
```

### HAVING and NOT_HAVING
HAVING and NOT_HAVING allow multi-value to be the operand such as array/vector, i.e. one-to-many relationship. For example, "keyA" contains "valueA" and "valueB"

```shell
criteria:
condition:
name: "extended_tags"
op: "BINARY_OP_HAVING"
value:
strArray:
value: ["c", "b"]
```

### MATCH
MATCH performances a full-text search if the tag is analyzed.
The string value applies to the same analyzer as the tag, but string array value does not.
Each item in a string array is seen as a token instead of a query expression.

How to set the analyzer for a tag can find in the [IndexRules](../schema/index-rule.md).

```shell
criteria:
condition:
name: "name"
op: "BINARY_OP_MATCH"
value:
str:
value: "us"
```

## [LogicalExpression.LogicalOp](../../../api-reference.md#logicalexpressionlogicalop)
Logical operation is used to combine multiple conditions.

### AND, OR
The following example queries the data where the `id` is `1` and the `service_id` is `service_1`

```shell
criteria:
le:
op: "LOGICAL_OP_AND"
right:
condition:
name: "id"
op: "BINARY_OP_EQ"
value:
str:
value: "1"
left:
condition:
name: "service_id"
op: "BINARY_OP_EQ"
value:
str:
value: "service_1"
```
Loading

0 comments on commit a20d7ae

Please sign in to comment.