Hi Matt,
If you mark your field as not_analyzed:
{
"mappings": {
"type1": {
"properties": {
"url": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
You could use a regexp query:
POST _search
{
"query": {
"regexp": {
"url": "http://example\.com/\d{4}/\d{2}/\d{2}/([^/]+)/$"
}
}
}
On Tue, Apr 15, 2014 at 5:57 PM, matt burton <[email protected]> wrote:
> I have a field in my documents that consists of a URL.
> {...
> "url":"http://example.com/2014/04/15/foo-bar-baz/"
> ...}
>
> I would like to use a regexp query/filter to find documents in my index
> with urls matching a regex pattern.
> For example: "http://example\.com/\d{4}/\d{2}/\d{2}/([^/]+)/$"
>
> I'm a bit stumped about how to configure an analyzer in the document
> _mapping to enable a regexp search (like above) for the url field. I've
> tried the standard and keyword analyzer, but they didn't work.
>
> I'm not even sure if this is possible to do, if not I'll can do it outside
> of ES, but I thought I'd ask here to see if ya'll had any guidance.
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/62e05ecc-500f-474e-a5e6-220a9eb86eb3%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/62e05ecc-500f-474e-a5e6-220a9eb86eb3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Luiz Guilherme P. Santos
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAMdL%3DZGwrZWON6tKoZDf4d0BOenDJDNyxaU0HfUOOV83%2Bh9KKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.