2
votes
  • Elasticsearch: 2.1
  • Timezone: +0800
  • Index: nginx-2015.12.18
  • Current Time: 2015-12-18 16:08

According to doc following query will resolve to index nginx-2015.12.18

curl -XGET 'localhost:9200/<nginx-{now/d}>/_search'

But, in reality it gives

{"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 'localhost: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
1
Can you update your question with the output you get when running curl localhost:9200/_cat/indices?v - Val

1 Answers

1
votes

As it turns out, this is a known issue, This is what @javanna said,

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.

I also had to escape the {}, This worked for me on ES 2.0

curl -XGET 'localhost:9200/<nginx-\{now%2Fd\}>/_search'

Does this help?