Strange behaviour term filter query


(mohit.Kumar) #1

hello folks,
I have a field name "AuthorLocationCountryCode" which contains the
abbrevation of the country code. Like United Kingdom = UK, India = IN ,
United State of America = US.
I am able to retrive data from elasticsearch with term filter query on US
and UK.
Below is the following query.
ELasticSearch Query :-
curl -XGET
'http://localhost:9200/new_index/new_indext/_search?pretty=false&size=2'
-d'{
"query": {
"match_all": {}
},
"filter": {
"term": {
"AuthorLocationCountryCode": "us"
}
},
"fields": [
"AuthorLocationCountryCode"
]
}'
OUTPUT :-
{"took":27,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2197,"max_score":1.0,"hits":[{"_index":"new_index","_type":"new_indext","_id":"317576659379314689","_score":1.0,"fields":{"AuthorLocationCountryCode":"US
"}},{"_index":"new_index","_type":"new_indext","_id":"317576773602770944","_score":1.0,"fields":{"AuthorLocationCountryCode":"US
"}}]}}

But the query return nothing for INDIA = IN, though we have 120 records.
Elasticsearch Query For INDIA = IN
*curl -XGET
'http://localhost:9200/new_index/new_indext/_search?pretty=false&size=2'
-d'{
"query": {
"match_all": {}
},
"filter": {
"term": {
"AuthorLocationCountryCode": "in"
}
},
"fields": [
"AuthorLocationCountryCode"
]
}'
OUTPUT :-
{"took":6,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
*

Will you please guide why this strange behaviour is occuring.
thanks in advance

regrds
Mohit

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(simonw-2) #2

any chance that you are using the standard analyzer and "IN" is treated as
a stopword and filtered away?

simon

On Sunday, September 8, 2013 12:52:32 PM UTC+2, Mohit Kumar Yadav wrote:

hello folks,
I have a field name "AuthorLocationCountryCode" which contains the
abbrevation of the country code. Like United Kingdom = UK, India = IN ,
United State of America = US.
I am able to retrive data from elasticsearch with term filter query on US
and UK.
Below is the following query.
ELasticSearch Query :-
curl -XGET '
http://localhost:9200/new_index/new_indext/_search?pretty=false&size=2'
-d'{
"query": {
"match_all": {}
},
"filter": {
"term": {
"AuthorLocationCountryCode": "us"
}
},
"fields": [
"AuthorLocationCountryCode"
]
}'
OUTPUT :-
{"took":27,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2197,"max_score":1.0,"hits":[{"_index":"new_index","_type":"new_indext","_id":"317576659379314689","_score":1.0,"fields":{"AuthorLocationCountryCode":"US
"}},{"_index":"new_index","_type":"new_indext","_id":"317576773602770944","_score":1.0,"fields":{"AuthorLocationCountryCode":"US
"}}]}}

But the query return nothing for INDIA = IN, though we have 120 records.
Elasticsearch Query For INDIA = IN
*curl -XGET '
http://localhost:9200/new_index/new_indext/_search?pretty=false&size=2'
-d'{
"query": {
"match_all": {}
},
"filter": {
"term": {
"AuthorLocationCountryCode": "in"
}
},
"fields": [
"AuthorLocationCountryCode"
]
}'
OUTPUT :-

{"took":6,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
*

Will you please guide why this strange behaviour is occuring.
thanks in advance

regrds
Mohit

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(mohit.Kumar) #3

hi simon,

I just download the elasticsearch, set the mapping and put some values and
start using it I have not set any analyzer. Here is my mapping query:
curl -XPUT 'http://localhost:9200/new_index/new_indext/_mapping'
-d'{"new_indext":{"properties":{"Message":{"type":"string"},"Name":{"type":"string"},"AuthorLocationCountryCode":{"type":"string"}}}}'

Is Elasticsearch has its default standard analyzer to filter stopword?
To use the analyzer I have to edit in my current mapping or I have to setup
another mapping.?
thank you for reply and yours precious time and advice.

On Sunday, September 8, 2013 11:22:57 PM UTC+5:30, simonw wrote:

any chance that you are using the standard analyzer and "IN" is treated as
a stopword and filtered away?

simon

On Sunday, September 8, 2013 12:52:32 PM UTC+2, Mohit Kumar Yadav wrote:

hello folks,
I have a field name "AuthorLocationCountryCode" which contains the
abbrevation of the country code. Like United Kingdom = UK, India = IN ,
United State of America = US.
I am able to retrive data from elasticsearch with term filter query on US
and UK.
Below is the following query.
ELasticSearch Query :-
curl -XGET '
http://localhost:9200/new_index/new_indext/_search?pretty=false&size=2'
-d'{
"query": {
"match_all": {}
},
"filter": {
"term": {
"AuthorLocationCountryCode": "us"
}
},
"fields": [
"AuthorLocationCountryCode"
]
}'
OUTPUT :-
{"took":27,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2197,"max_score":1.0,"hits":[{"_index":"new_index","_type":"new_indext","_id":"317576659379314689","_score":1.0,"fields":{"AuthorLocationCountryCode":"US
"}},{"_index":"new_index","_type":"new_indext","_id":"317576773602770944","_score":1.0,"fields":{"AuthorLocationCountryCode":"US
"}}]}}

But the query return nothing for INDIA = IN, though we have 120 records
.
Elasticsearch Query For INDIA = IN
*curl -XGET '
http://localhost:9200/new_index/new_indext/_search?pretty=false&size=2'
-d'{
"query": {
"match_all": {}
},
"filter": {
"term": {
"AuthorLocationCountryCode": "in"
}
},
"fields": [
"AuthorLocationCountryCode"
]
}'
OUTPUT :-

{"took":6,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
*

Will you please guide why this strange behaviour is occuring.
thanks in advance

regrds
Mohit

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Luca Cavanna) #4

Hi,
yes english stopwords are applied by default, you need to submit your own
mapping ither while creating the index or using the put mapping api.

Cheers

On Monday, September 9, 2013 2:07:47 PM UTC+2, Mohit Kumar Yadav wrote:

hi simon,

I just download the elasticsearch, set the mapping and put some values and
start using it I have not set any analyzer. Here is my mapping query:
curl -XPUT 'http://localhost:9200/new_index/new_indext/_mapping'
-d'{"new_indext":{"properties":{"Message":{"type":"string"},"Name":{"type":"string"},"AuthorLocationCountryCode":{"type":"string"}}}}'

Is Elasticsearch has its default standard analyzer to filter stopword?
To use the analyzer I have to edit in my current mapping or I have to
setup another mapping.?
thank you for reply and yours precious time and advice.

On Sunday, September 8, 2013 11:22:57 PM UTC+5:30, simonw wrote:

any chance that you are using the standard analyzer and "IN" is treated
as a stopword and filtered away?

simon

On Sunday, September 8, 2013 12:52:32 PM UTC+2, Mohit Kumar Yadav wrote:

hello folks,
I have a field name "AuthorLocationCountryCode" which contains the
abbrevation of the country code. Like United Kingdom = UK, India = IN ,
United State of America = US.
I am able to retrive data from elasticsearch with term filter query on
US and UK.
Below is the following query.
ELasticSearch Query :-
curl -XGET '
http://localhost:9200/new_index/new_indext/_search?pretty=false&size=2'
-d'{
"query": {
"match_all": {}
},
"filter": {
"term": {
"AuthorLocationCountryCode": "us"
}
},
"fields": [
"AuthorLocationCountryCode"
]
}'
OUTPUT :-
{"took":27,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2197,"max_score":1.0,"hits":[{"_index":"new_index","_type":"new_indext","_id":"317576659379314689","_score":1.0,"fields":{"AuthorLocationCountryCode":"US
"}},{"_index":"new_index","_type":"new_indext","_id":"317576773602770944","_score":1.0,"fields":{"AuthorLocationCountryCode":"US
"}}]}}

*But the query return nothing for INDIA = IN, though we have 120 records
*.
Elasticsearch Query For INDIA = IN
*curl -XGET '
http://localhost:9200/new_index/new_indext/_search?pretty=false&size=2'
-d'{
"query": {
"match_all": {}
},
"filter": {
"term": {
"AuthorLocationCountryCode": "in"
}
},
"fields": [
"AuthorLocationCountryCode"
]
}'
OUTPUT :-

{"took":6,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
*

Will you please guide why this strange behaviour is occuring.
thanks in advance

regrds
Mohit

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(simonw-2) #5

yes you need to change your mapping. I'd just use simple analyzer for
this lanugage field which just lowercases basically.

simon

On Monday, September 9, 2013 2:07:47 PM UTC+2, Mohit Kumar Yadav wrote:

hi simon,

I just download the elasticsearch, set the mapping and put some values and
start using it I have not set any analyzer. Here is my mapping query:
curl -XPUT 'http://localhost:9200/new_index/new_indext/_mapping'
-d'{"new_indext":{"properties":{"Message":{"type":"string"},"Name":{"type":"string"},"AuthorLocationCountryCode":{"type":"string"}}}}'

Is Elasticsearch has its default standard analyzer to filter stopword?
To use the analyzer I have to edit in my current mapping or I have to
setup another mapping.?
thank you for reply and yours precious time and advice.

On Sunday, September 8, 2013 11:22:57 PM UTC+5:30, simonw wrote:

any chance that you are using the standard analyzer and "IN" is treated
as a stopword and filtered away?

simon

On Sunday, September 8, 2013 12:52:32 PM UTC+2, Mohit Kumar Yadav wrote:

hello folks,
I have a field name "AuthorLocationCountryCode" which contains the
abbrevation of the country code. Like United Kingdom = UK, India = IN ,
United State of America = US.
I am able to retrive data from elasticsearch with term filter query on
US and UK.
Below is the following query.
ELasticSearch Query :-
curl -XGET '
http://localhost:9200/new_index/new_indext/_search?pretty=false&size=2'
-d'{
"query": {
"match_all": {}
},
"filter": {
"term": {
"AuthorLocationCountryCode": "us"
}
},
"fields": [
"AuthorLocationCountryCode"
]
}'
OUTPUT :-
{"took":27,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2197,"max_score":1.0,"hits":[{"_index":"new_index","_type":"new_indext","_id":"317576659379314689","_score":1.0,"fields":{"AuthorLocationCountryCode":"US
"}},{"_index":"new_index","_type":"new_indext","_id":"317576773602770944","_score":1.0,"fields":{"AuthorLocationCountryCode":"US
"}}]}}

*But the query return nothing for INDIA = IN, though we have 120 records
*.
Elasticsearch Query For INDIA = IN
*curl -XGET '
http://localhost:9200/new_index/new_indext/_search?pretty=false&size=2'
-d'{
"query": {
"match_all": {}
},
"filter": {
"term": {
"AuthorLocationCountryCode": "in"
}
},
"fields": [
"AuthorLocationCountryCode"
]
}'
OUTPUT :-

{"took":6,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
*

Will you please guide why this strange behaviour is occuring.
thanks in advance

regrds
Mohit

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #6