Term search on URL literal doesn't match

I'm having a problem doing a term query for documents that have a literal
match on a string containing a URL. Here's a gist demonstrating the
issue: https://gist.github.com/1508383

The query was done on a fresh install of ElasticSearch version 0.18.5. Any
idea what I'm doing wrong here?

--
Allan

By default, the standard analyzer breaks a url into several tokens, and
does not keep it as a single token. Since term query is provided with a
term (there is no analysis process on the text) it will not match.

You have two option, either mark the url field in the mapping as "index" :
"not_analyzed", and then the term query will work, or use text query, which
will break the url into several terms on the search side. The second option
does mean that you will also possibly find "non exact" matches.

If you want to combine the two worlds, use multi field mapping (
Elasticsearch Platform — Find real-time answers at scale | Elastic)
to have the url analyzed and not analyzed, and then choose on which field
to search based on your use case.

On Thu, Dec 22, 2011 at 2:42 AM, Allan Caffee allan.caffee@gmail.comwrote:

I'm having a problem doing a term query for documents that have a literal
match on a string containing a URL. Here's a gist demonstrating the issue:
ElasticSearch (version 0.18.5) term query for literal url match · GitHub

The query was done on a fresh install of Elasticsearch version 0.18.5.
Any idea what I'm doing wrong here?

--
Allan