infinilabs / gateway

🚀 A High-performance gateway designed for search scenarios. Good friend of Elasticsearch/Opensearch/Easysearch.
https://www.infinilabs.com/en/docs/latest/gateway/
28 stars 3 forks source link

not support date_math_expr like %3Cmy-index-%7Bnow%2Fd%7D%3E #41

Closed dyrnq closed 4 months ago

dyrnq commented 6 months ago

Description

# PUT /<my-index-{now/d}>
PUT /%3Cmy-index-%7Bnow%2Fd%7D%3E

ref https://www.elastic.co/guide/en/elasticsearch/reference/8.12/api-conventions.html#api-date-math-index-names

Steps to reproduce

curl call put index API

Actual behavior

curl -H "Content-Type: application/json" -u elastic:test123 \
http://192.168.6.177:8000/%3Cdemo-app-logs-%7Bnow%2Fd%7D%3E/_doc/a8dbd0ad-c965-4612-b9eb-b798d8227bd1 -XPUT -d '{"dd":11}'

{"error":"no handler found for uri [/%3Cdemo-app-logs-%7Bnow/d%7D%3E/_doc] and method [PUT]"}

A description of what you expected to happen.

Expected behavior

curl -H "Content-Type: application/json" -u elastic:test123 \ 
http://192.168.6.175:9200/%3Cdemo-app-logs-%7Bnow%2Fd%7D%3E/_doc/a8dbd0ad-c965-4612-b9eb-b798d8227bd1 -XPUT -d '{"dd":11}'
{"_index":"demo-app-logs-2024.03.02","_id":"a8dbd0ad-c965-4612-b9eb-b798d8227bd1","_version":2,"result":"updated","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":1,"_primary_term":1}

Environment

elasticsearch:8.11.3

[GATEWAY] A light-weight, powerful and high-performance search gateway. [GATEWAY] 1.21.0#1229, 2023-12-28 08:22:36, 2024-12-31 10:10:10, 5ca75b9539303a3ceb62e37e72811b580e7e004f gateway 1.21.0 1229 2023-12-28 08:22:36 +0000 UTC 2024-12-31 10:10:10 +0000 UTC 5ca75b9539303a3ceb62e37e72811b580e7e004f

medcl commented 4 months ago

@medcl Thanks for reporting this, can you also attach your configurations, i just did a test with this config:

env:
  LR_GATEWAY_HOST: 127.0.0.1:8001
  LR_GATEWAY_API_HOST: 127.0.0.1:9000
  ELASTICSEARCH_ENDPOINT: ['https://127.0.0.1:9200']
path.data: data
path.logs: log

stats:
  enabled: false

entry:
  - name: my_es_entry
    enabled: true
    router: my_router
    max_concurrency: 10000
    network:
      binding: $[[env.LR_GATEWAY_HOST]]

flow:
  - name: es-flow
    filter:
      - elasticsearch:
          elasticsearch: es-server
          refresh:
            enabled: true
            interval: 10s
          fixed_client: true
          client_mode: host
          timeout: -1
          skip_cleanup_hop_headers: true
          skip_keep_original_uri: true
          skip_metadata_enrich: true

router:
  - name: my_router
    default_flow: es-flow

elasticsearch:
  - name: es-server
    enabled: true
    endpoints: $[[env.ELASTICSEARCH_ENDPOINT]]
    basic_auth:
      username: admin
      password: xxx
    discovery:
      enabled: true
      refresh:
        enabled: true
        interval: 60s

Seems all good:

image
medcl commented 4 months ago

fell free to reopen or provide more details.