Term filter not working for select strings?

Hi!

I recently discovered select term filters weren't working on my dataset,
and narrowed it down to an example involving two letter strings.

This is reproducible on 0.90.2/5/7 both locally and on remote hosts with
the following commands:

curl -XPUT 'http://localhost:9200/index1/type1/1' -d '{"code":"zh",
"name":"China"}'
curl -XPUT 'http://localhost:9200/index1/type1/2' -d '{"code":"in",
"name":"India"}'

curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"code":"zh"}}}' // returns Doc 1
curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"code":"in"}}}' // returns nothing

curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"name":"china"}}}' // returns Doc 1
curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"name":"india"}}}' // returns Doc 2

No mappings or analyzers were used. Is there something obvious I'm missing
here? Thanks!
~Karen

--
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/92cf01a9-9942-4f7e-8fd0-f39e9ed8805b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

The default analyzer uses a stop word filter and "in" is considered a stop
word. If you are using term queries, then setting your field to
non_analyzed will probably be your best fix.

Cheers,

Ivan

On Thu, Jan 2, 2014 at 8:27 PM, kakaner kakaner@gmail.com wrote:

Hi!

I recently discovered select term filters weren't working on my dataset,
and narrowed it down to an example involving two letter strings.

This is reproducible on 0.90.2/5/7 both locally and on remote hosts with
the following commands:

curl -XPUT 'http://localhost:9200/index1/type1/1' -d '{"code":"zh",
"name":"China"}'
curl -XPUT 'http://localhost:9200/index1/type1/2' -d '{"code":"in",
"name":"India"}'

curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"code":"zh"}}}' // returns Doc 1
curl 'http://localhost:9200/index1/type1/_search
http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"code":"in"}}}' // returns nothing

curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"name":"china"}}}' // returns Doc 1
curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"name":"india"}}}' // returns Doc 2

No mappings or analyzers were used. Is there something obvious I'm missing
here? Thanks!
~Karen

--
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/92cf01a9-9942-4f7e-8fd0-f39e9ed8805b%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/CALY%3DcQCxv2KxnwN1A5cwWFYa_P%3DdRmtLoHTsSi9PjWjVuR%3Dzdw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks Ivan!! That makes a ton of sense and can't believe I overlooked
that. Happened to be one of our unmapped fields :slight_smile:

On Friday, January 3, 2014 12:42:52 AM UTC-5, Ivan Brusic wrote:

The default analyzer uses a stop word filter and "in" is considered a stop
word. If you are using term queries, then setting your field to
non_analyzed will probably be your best fix.

Cheers,

Ivan

On Thu, Jan 2, 2014 at 8:27 PM, kakaner <kak...@gmail.com <javascript:>>wrote:

Hi!

I recently discovered select term filters weren't working on my dataset,
and narrowed it down to an example involving two letter strings.

This is reproducible on 0.90.2/5/7 both locally and on remote hosts with
the following commands:

curl -XPUT 'http://localhost:9200/index1/type1/1' -d '{"code":"zh",
"name":"China"}'
curl -XPUT 'http://localhost:9200/index1/type1/2' -d '{"code":"in",
"name":"India"}'

curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"code":"zh"}}}' // returns Doc 1
curl 'http://localhost:9200/index1/type1/_search
http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"code":"in"}}}' // returns nothing

curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"name":"china"}}}' // returns Doc 1
curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"name":"india"}}}' // returns Doc 2

No mappings or analyzers were used. Is there something obvious I'm
missing here? Thanks!
~Karen

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/92cf01a9-9942-4f7e-8fd0-f39e9ed8805b%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/e7973b97-e891-4918-b76f-60c13817aae9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

After all my years of development, I would be surprised if I did NOT make a
silly mistake!

--
Ivan

On Thu, Jan 2, 2014 at 10:08 PM, kakaner kakaner@gmail.com wrote:

Thanks Ivan!! That makes a ton of sense and can't believe I overlooked
that. Happened to be one of our unmapped fields :slight_smile:

On Friday, January 3, 2014 12:42:52 AM UTC-5, Ivan Brusic wrote:

The default analyzer uses a stop word filter and "in" is considered a
stop word. If you are using term queries, then setting your field to
non_analyzed will probably be your best fix.

Cheers,

Ivan

On Thu, Jan 2, 2014 at 8:27 PM, kakaner kak...@gmail.com wrote:

Hi!

I recently discovered select term filters weren't working on my dataset,
and narrowed it down to an example involving two letter strings.

This is reproducible on 0.90.2/5/7 both locally and on remote hosts with
the following commands:

curl -XPUT 'http://localhost:9200/index1/type1/1' -d '{"code":"zh",
"name":"China"}'
curl -XPUT 'http://localhost:9200/index1/type1/2' -d '{"code":"in",
"name":"India"}'

curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"code":"zh"}}}' // returns Doc 1
curl 'http://localhost:9200/index1/type1/_search
http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"code":"in"}}}' // returns nothing

curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"name":"china"}}}' // returns Doc 1
curl 'http://localhost:9200/index1/type1/_search' -d
'{"query":{"term":{"name":"india"}}}' // returns Doc 2

No mappings or analyzers were used. Is there something obvious I'm
missing here? Thanks!
~Karen

--
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 elasticsearc...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/92cf01a9-9942-4f7e-8fd0-f39e9ed8805b%
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/e7973b97-e891-4918-b76f-60c13817aae9%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/CALY%3DcQDMoQ9pB%2BCRDTscQWCLmZBh0H71kFFFvEO-Kof0BwDvEg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.