Escaping trouble with the pattern tokenizer/analyzer

Hi,

I tried using the pattern analyzer using the \s pattern for whitespace
characters.
There's also an example of this on
http://www.elasticsearch.org/guide/reference/index-modules/analysis/pattern-analyzer/

However, using this will fail because JSON will recognize the bashslash as
an escape sequence:

$ curl -XPUT 'localhost:9200/test' -d '
{
"settings":{
"analysis": {
"analyzer": {
"whitespace":{
"type": "pattern",
"pattern":"\s+"
}
}
}
}
}'
{"error":"ElasticSearchParseException[failed to parse source for create
index]; nested: JsonParseException[Unrecognized character escape 's' (code
115)\n at [Source: [B@3274bcd3; line: 8, column: 38]]; ","status":400}

Can anyone recommend a way to make the JSON Parser accept regular
expressions?

Thanks,
David

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

On Wednesday, May 29, 2013 2:57:15 PM UTC+2, David Raison wrote:

However, using this will fail because JSON will recognize the bashslash as
an escape sequence:

Double escaping it actually worked:

"pattern":"\s+"

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

1 Like