gpt4 book ai didi

elasticsearch - 索引名称中的Elasticsearch日期匹配不起作用

转载 作者:行者123 更新时间:2023-12-02 22:31:59 25 4
gpt4 key购买 nike

  • Elasticsearch:2.1
  • 时区:+0800
  • 索引:nginx-2015.12.18
  • 当前时间:2015-12-18 16:08

  • 根据 doc,以下查询将解析为索引 nginx-2015.12.18 curl -XGET 'localhost:9200/<nginx-{now/d}>/_search'
    但是,实际上
    {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"<nginx-now","index":"<nginx-now"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"<nginx-now","index":"<nginx-now"},"status":404}

    curl'本地主机:9200 / _cat / indices?v'

    ⋊> ~ curl 'localhost:9200/_cat/indices?v' 16:31:35


    health status index              pri rep docs.count docs.deleted store.size pri.store.size 
    yellow open nginx 5 1 18 0 120.7kb 120.7kb
    yellow open wx-data-2015.12.18 5 1 2 0 9.6kb 9.6kb
    yellow open nginx-2015.12.18 5 1 5 0 33kb 33kb

    最佳答案

    事实证明,这是一个known issue,这就是@javanna所说的,

    we had initially treated this as a bug and fixed it, but afterwards we found out that the fix introduced a regression (#14177), which made us take a step back. Any slash that should not be used as a path separator in a uri should be properly escaped, and it is wrong to try and make distinctions between the different slashes on the server side depending on what surrounds them, that heuristic is not going to fly (in fact it didn't :) )

    We are going to revert the initial fix then, the solution to this problem is to escape the '/' in the url like this: curl -XGET 'localhost:9200/<logstash-{now%2Fd}>/animals/1'. That is going to work and didn't require any fix in the first place.



    我还必须转义 {},这对 ES 2.0有用
    curl -XGET 'localhost:9200/<nginx-\{now%2Fd\}>/_search'

    这有帮助吗?

    关于elasticsearch - 索引名称中的Elasticsearch日期匹配不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34351094/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com