Skip to content

Instantly share code, notes, and snippets.

@medcl
Created August 12, 2022 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save medcl/f1dd7eb9b86c38b3252239d57c60966c to your computer and use it in GitHub Desktop.
Save medcl/f1dd7eb9b86c38b3252239d57c60966c to your computer and use it in GitHub Desktop.
entry:
- max_concurrency: 200000
router: my-router
name: my-entry
enabled: true
network:
binding: 0.0.0.0:8001
reuse_port: false
router:
- name: my-router
rules:
- method: '*'
pattern:
- /es-710-test/company_basic/_search
flow:
- es-710-test_company_basic
elasticsearch:
- basic_auth:
# password: 'xxxx'
# username: xxxx
endpoints:
- http://192.168.3.188:9206
traffic_control:
max_qps_per_node: 20000
discovery:
refresh:
interval: 30s
enabled: true
enabled: true
name: es-710-test
enabled: true
flow:
- filter:
- set_context:
context:
_ctx.request.path: /company_basic/_search
- request_path_limiter:
rules:
- pattern: /(?P<index_name>company_basic)/_search
max_qps: 200
group: index_name
message: 'out of the limit : 200'
- basic_auth:
valid_users:
zk: '12345' #changed to 1234
# - set_basic_auth:
# password: '123456'
# username: elastic
- elasticsearch:
elasticsearch: es-710-test
refresh:
interval: 30s
enabled: true
name: es-710-test_company_basic
# ➜ ~ curl http://localhost:8001/es-710-test/company_basic/_search -u zk:12345
# {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [company_basic]","resource.type":"index_or_alias","resource.id":"company_basic","index_uuid":"_na_","index":"company_basic"}],"type":"index_not_found_exception","reason":"no such index [company_basic]","resource.type":"index_or_alias","resource.id":"company_basic","index_uuid":"_na_","index":"company_basic"},"status":404}% ➜ ~ curl http://localhost:8001/es-710-test/company_basic/_search -u zk:1234
# Unauthorized%
# ➜ ~ curl http://localhost:8001/es-710-test/company_basic/_search -u zk:1234
# {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [company_basic]","resource.type":"index_or_alias","resource.id":"company_basic","index_uuid":"_na_","index":"company_basic"}],"type":"index_not_found_exception","reason":"no such index [company_basic]","resource.type":"index_or_alias","resource.id":"company_basic","index_uuid":"_na_","index":"company_basic"},"status":404}%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment