How should I escape a string like /abc/


(vivek chand-2) #1

Say, I did
curl -XPUT "http://localhost:9200/movies/movie/3" -d'
{
"title": "The Godfather",
"director": "Francis Ford Coppola",
"year": 1972,
"genres": ["/abc/", "/def/"]
}'
And, I tried searching by
curl -XPOST "http://localhost:9200/_search" -d'
{
"query": {
"filtered": {
"query": {
"match_all":{}
},
"filter": {
"term": { "genres": ["/abc/"] }
}
}
}
}'
And, I got
{"took":1,"timed_out":false,"_shards":{"total":5,"
successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

I also did search by escaping "/abc/" as "/abc/"
curl -XPOST "http://localhost:9200/_search" -d'
{
"query": {
"filtered": {
"query": {
"match_all":{}
},
"filter": {
"term": { "genres": ["/abc/"] }
}
}
}
}'
And, I got
{"took":1,"timed_out":false,"_shards":{"total":5,"
successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

To Summarize, I need help on how should I escape the string "/abc/" to
search it?

Thanks a lot,
Vivek

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/51aa8cd7-eee0-4ba0-98b0-38c78933ce6e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

I guess you should not use default analyzer (standard) for this field or don't analyze at all this field.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 2 décembre 2013 at 12:18:54, vivek chand (vivekchand19@gmail.com) a écrit:

Say, I did
curl -XPUT "http://localhost:9200/movies/movie/3" -d'
{
"title": "The Godfather",
"director": "Francis Ford Coppola",
"year": 1972,
"genres": ["/abc/", "/def/"]
}'
And, I tried searching by
curl -XPOST "http://localhost:9200/_search" -d'
{
"query": {
"filtered": {
"query": {
"match_all":{}
},
"filter": {
"term": { "genres": ["/abc/"] }
}
}
}
}'
And, I got
{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

I also did search by escaping "/abc/" as "/abc/"
curl -XPOST "http://localhost:9200/_search" -d'
{
"query": {
"filtered": {
"query": {
"match_all":{}
},
"filter": {
"term": { "genres": ["/abc/"] }
}
}
}
}'
And, I got
{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

To Summarize, I need help on how should I escape the string "/abc/" to search it?

Thanks a lot,
Vivek

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/51aa8cd7-eee0-4ba0-98b0-38c78933ce6e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.529c83e0.2ae8944a.b39a%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3