Indexing \n as \n in elasticsearch

Hi all.....

Here i am trying to index \n as a field values in elasticsearch
here is my mapping

PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "city": {
          "type": "text"
          
        }
      }
    }
  }
}

and i am using kibana devtool for indexing document into it

PUT my_index/my_type/1
{
  "city": "\ntomorrow"
}

but i kibana i am seeing field value like city: tomorrow
but i want it to store as it is city:\ntomorrow
how can i do that ?
similarly i am trying to index new document something like this

PUT my_index/my_type/2
{
  "city": "\Xtomorrow"
}

above query gives me error something like this

 {
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "failed to parse [city]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "failed to parse [city]",
    "caused_by": {
      "type": "i_o_exception",
      "reason": "Unrecognized character escape 'X' (code 88)\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@5874096a; line: 2, column: 14]"
    }
  },
  "status": 400
}

but in this case also i want elasticsearch to store city values as city:\Xtomorrow.
how can i do that.

Thank You.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.