0
votes

I am currently using elasticsearch 1.3 and hope to get advice on the below question. I understand that I can execute http://localhost:9200/[index_name]/[index_type]/[_id] using Sense to search for a particular document in the index, but I have documents where the _id has # symbols which Sense couldn't find them. I tried to change the # to %23 (in javascript) and managed to find the document. I would like to check whether will Analyzer helps? I am so sure if I understand the elasticsearch's analyzer correctly.

1
The reason is simply because your id contains characters that need to be URL-encoded (#=> %23), this has nothing to do with analyzers - Val
@Val thanks for the response. Can I know whether is there any workaround beside changing it to %23? I asked this question because there might be other special characters which might appear in the _id. - xxestter

1 Answers

1
votes

You either need run your ID through an URL-encoder before adding it to your URL or you can also search for it using the ids query like this without having to encode it:

POST index/_search
{
  "query": {
    "ids": {
      "values": ["2323#23423"]
    }
  }
}