Skip to content

Commit

Permalink
Merge branch 'main' of github.com:aliyun-sls/sls-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
wangtao0101 committed Nov 26, 2024
2 parents d30dc28 + a403b86 commit c06f3e3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .vitepress/siderbars/getOscompatibleDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ function getSidebar() {
// { text: 'Sarama-Kafka-Go示例', link: '/oscompatibledemo/sarama_go_kafka_consume' },
],
},
{
text: 'ES兼容',
items: [
{ text: '最佳实践', link: '/oscompatibledemo/es_best_practice' },
],
},
]
}

Expand Down
36 changes: 36 additions & 0 deletions src/oscompatibledemo/es_best_practice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ES兼容最佳实践

## QueryString最佳实践

* 指定字段的查询比不指定字段的查询友好, 不指定字段的query可能在某些情况下被翻译成sql 字段concat后再匹配,导致查询效率低下

这是友好的
```
content: "Hello World"
```

这是不友好的
```
"Hello World"
```

* 尽量少使用wildcard查询(带*匹配的查询),如果是频繁查询(比如告警)的情况下,尽量使用精准的匹配
举例说明:

这是一个友好的
```
content : "Hello World"
```

这是不友好的,因为带*会使用通配,产生硬扫
```
content : "Hello*"
```








5 changes: 5 additions & 0 deletions src/oscompatibledemo/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
| [Kafka Java SDK](./kafka_java.md) | 使用Java Kafka SDK写入/消费 SLS Logstore |
| [Kafka Golang SDK](./kafka_go.md) | 使用Golang Kafka SDK写入/消费 SLS Logstore |
| [Kafka Python SDK](./kafka_python.md) | 使用Python Kafka SDK写入/消费 SLS Logstore |


## ES兼容

* [SLS的ES兼容最佳实践](./es_best_practice.md)

0 comments on commit c06f3e3

Please sign in to comment.