A term query will not analyze the search terms, so if your countries field
is using the default analyze, there will be no match since the standard
analyzer will lowercase the terms. Either set your field as not_analyzed or
use another query such as match.

-- 
Ivan

On Sat, Nov 22, 2014 at 4:35 PM, dashaus <emili....@gmail.com> wrote:

> Hi!,
> I have a document like this:
> {
>    "type": "film",
>    "countries": ["US", "ES"]
> }
>
> And i insert it in elasticsearch, then i do the follow search:
>
> GET _search?search_type=dfs_query_and_fetch
> {
>   "query": {
>     "filtered": {
>       "query": {
>         "term": {"type": "film"}
>       },
>       "filter": {
>         "query": {
>           "terms": {
>             "countries": [
>               "US",
>               "ES"
>             ]
>           }
>         }
>       }
>     }
>   }
> }
>
> But I get a result without the document...But if I change the "terms"
> filter
> to...
>
> ....
>  "terms": {
>     "countries": [
>         "us",
>          "es"
>      ]
> }
> ....
>
> Then I get a result with the document! So, this is a bug or is a desired
> behavior?
>
> Thanks!
>
> Cheers,
> Emilio
>
>
>
> --
> View this message in context:
> http://elasticsearch-users.115913.n3.nabble.com/terms-filter-with-the-value-to-match-in-upercase-is-not-possible-tp4066613.html
> Sent from the ElasticSearch Users mailing list archive at Nabble.com.
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/1416692143551-4066613.post%40n3.nabble.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBNeyJ%2Bx70Fy6HfEPDpCELGvWhKdJ%2BLKae1S0wpnfxeBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to