Searching on terms with dashes

We have a document that is basically like so:

{
"_index" : "foo",
"_type" : "log",
"_id" : "6fWTxYKQT1GVD05o5arkFg",
"_score" : 1.0, "_source" :
{"timestamp":"2011-04-17T23:39:00.551Z","host":"ip-10-85-67-73.ec2.internal","priority":"INFO","message":
{"text":"....\n"},"fields":{"domain":"foo-bar.foo.com"}}
}

I'm trying to do an exact search based on the domain. For example:

curl http://localhost:9200/ion/_search?pretty=true -d '{ "query" :
{ "term" : { "fields.domain" : "foo-bar.foo.com" } } }'

However, this just returns an empty result. If I remove the dash, it
works. What can I do here to be able to search with dashes???

Dan

change the mapping for the field like so (quotes removed for readability):

domain:{type:string, index:not_analyzed}

this page describes the details:

& this one might be useful too:

-david

On Mon, Apr 18, 2011 at 1:28 PM, Dan Diephouse diephouse@gmail.com wrote:

We have a document that is basically like so:

{
"_index" : "foo",
"_type" : "log",
"_id" : "6fWTxYKQT1GVD05o5arkFg",
"_score" : 1.0, "_source" :
{"timestamp":"2011-04-17T23:39:00.551Z","host":"ip-10-85-67-73.ec2.internal","priority":"INFO","message":
{"text":"....\n"},"fields":{"domain":"foo-bar.foo.com"}}
}

I'm trying to do an exact search based on the domain. For example:

curl http://localhost:9200/ion/_search?pretty=true -d '{ "query" :
{ "term" : { "fields.domain" : "foo-bar.foo.com" } } }'

However, this just returns an empty result. If I remove the dash, it
works. What can I do here to be able to search with dashes???

Dan