Missing Filter not working

I want to query the group_moel field that contains null value, but i am
not getting the right result:
group_model is a field using default mapping setting. the result have
records which group_model = "IS"

curl -X GET '
http://localhost:9200/manufactured_tires/manufactured_tire/_search?from=0&size=100&pretty' -d
'{"filter":{"missing": {"field": "group_model", "null_value": null}}}'

Result:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 9,
"max_score" : 1.0,
"hits" : [ {
"_index" : "manufactured_tires-2013-03-04",
"_type" : "manufactured_tire",
"_id" : "6f0gOX7sRZu1gQjZUhlgXA",
"_score" : 1.0, "_source" :
{"aspect_ratio":"40","car_designation":"E","load_range":"","load_rating_index":"93","make":"LEXUS","model":"IS
F
Base","primary_secondary":"1","radial_construction":"R","rim_diameter":"19","section_width":"225","speed_rating":"Y","tire_designation":"1","tire_size":"225/40R19","year":2011,"id":"6f0gOX7sRZu1gQjZUhlgXA","_type":"manufactured_tire","_score":0.0,"_index":"manufactured_tires-2013-03-04","_version":null,"sort":null,"highlight":null,"_explanation":null,"group_model":"IS"}

}, { 
  "_index" : "manufactured_tires-2013-03-04", 
  "_type" : "manufactured_tire", 
  "_id" : "ep9IXrlOR4Sqvek5c41HQg", 
  "_score" : 1.0, "_source" : 

{"aspect_ratio":"35","car_designation":"E","load_range":"","load_rating_index":"96","make":"LEXUS","model":"IS
F
Base","primary_secondary":"1","radial_construction":"R","rim_diameter":"19","section_width":"255","speed_rating":"Y","tire_designation":"2","tire_size":"255/35R19","year":2009,"id":"ep9IXrlOR4Sqvek5c41HQg","_type":"manufactured_tire","_score":0.0,"_index":"manufactured_tires-2013-03-04","_version":null,"sort":null,"highlight":null,"_explanation":null,"group_model":"IS"}

....

--
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.

can you try

{
"constant_score" : {
"filter" : {
"missing" : {
"field" : "group_model",
"existence" : true,
"null_value" : true
}
}
}
}

On Monday, March 11, 2013 7:36:35 PM UTC+1, Victor wrote:

I want to query the group_moel field that contains null value, but i am
not getting the right result:
group_model is a field using default mapping setting. the result have
records which group_model = "IS"

curl -X GET '
http://localhost:9200/manufactured_tires/manufactured_tire/_search?from=0&size=100&pretty' -d
'{"filter":{"missing": {"field": "group_model", "null_value": null}}}'

Result:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 9,
"max_score" : 1.0,
"hits" : [ {
"_index" : "manufactured_tires-2013-03-04",
"_type" : "manufactured_tire",
"_id" : "6f0gOX7sRZu1gQjZUhlgXA",
"_score" : 1.0, "_source" :
{"aspect_ratio":"40","car_designation":"E","load_range":"","load_rating_index":"93","make":"LEXUS","model":"IS
F
Base","primary_secondary":"1","radial_construction":"R","rim_diameter":"19","section_width":"225","speed_rating":"Y","tire_designation":"1","tire_size":"225/40R19","year":2011,"id":"6f0gOX7sRZu1gQjZUhlgXA","_type":"manufactured_tire","_score":0.0,"_index":"manufactured_tires-2013-03-04","_version":null,"sort":null,"highlight":null,"_explanation":null,"group_model":"IS"}

}, { 
  "_index" : "manufactured_tires-2013-03-04", 
  "_type" : "manufactured_tire", 
  "_id" : "ep9IXrlOR4Sqvek5c41HQg", 
  "_score" : 1.0, "_source" : 

{"aspect_ratio":"35","car_designation":"E","load_range":"","load_rating_index":"96","make":"LEXUS","model":"IS
F
Base","primary_secondary":"1","radial_construction":"R","rim_diameter":"19","section_width":"255","speed_rating":"Y","tire_designation":"2","tire_size":"255/35R19","year":2009,"id":"ep9IXrlOR4Sqvek5c41HQg","_type":"manufactured_tire","_score":0.0,"_index":"manufactured_tires-2013-03-04","_version":null,"sort":null,"highlight":null,"_explanation":null,"group_model":"IS"}

....

--
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.

got the same result:
with added options:

curl -X GET '
http://localhost:9200/manufactured_tires/manufactured_tire/_search?from=0&size=1&pretty'
-d '{"filter":{"missing": {"field": "group_model", "null_value": true,
"existence": true}}}'

On Mon, Mar 11, 2013 at 1:33 PM, simonw
simon.willnauer@elasticsearch.comwrote:

can you try

{
"constant_score" : {

    "filter" : {
        "missing" : {
            "field" : "group_model",

            "existence" : true,
            "null_value" : true
        }
    }
}

}

On Monday, March 11, 2013 7:36:35 PM UTC+1, Victor wrote:

I want to query the group_moel field that contains null value, but i am
not getting the right result:
group_model is a field using default mapping setting. the result have
records which group_model = "IS"

curl -X GET 'http://localhost:9200/manufactured_tires/
manufactured_tire/_search?**from=0&size=100&pretty'http://localhost:9200/manufactured_tires/manufactured_tire/_search?from=0&size=100&pretty' -d
'{"filter":{"missing": {"field": "group_model", "null_value": null}}}'

Result:
{
"took" : 1,
"timed_out" : false,
"shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 9,
"max_score" : 1.0,
"hits" : [ {
"index" : "manufactured_tires-2013-03-04",
"_type" : "manufactured_tire",
"_id" : "6f0gOX7sRZu1gQjZUhlgXA",
"_score" : 1.0, "source" : {"aspect_ratio":"40","car

designation":"E","load_range":"","load_rating_index":"93","make":"LEXUS","model":"IS
F Base","primary_secondary":"1",
"radial_construction":"R","

rim_diameter":"19","section
width":"225","speed_rating":"
Y","tire_designation":"1","**tire_size":"225/40R19","year":*2011,"id":"
*6f0gOX7sRZu1gQjZUhlgXA","
type":"manufactured_tire","_
score":0.0,"_index":"manufactured_tires-2013-03-04"
,"_version":null,"sort":null,"highlight":null,"_explanation":null,"group_model":"IS"}

}, {
  "_index" : "manufactured_tires-2013-03-**04",
  "_type" : "manufactured_tire",
  "_id" : "ep9IXrlOR4Sqvek5c41HQg",
  "_score" : 1.0, "_source" : {"aspect_ratio":"35","car_**

designation":"E","load_range":"","load_rating_index":"96","make":"LEXUS","model":"IS
F Base","primary_secondary":"1",
"radial_construction":"R","

rim_diameter":"19","section_width":"255","speed_rating":"
Y","tire_designation":"2","**tire_size":"255/35R19","year":2009,"id":"
ep9IXrlOR4Sqvek5c41HQg","**type":"manufactured_tire","

score":0.0,"_index":"manufactured_tires-2013-03-04"
,"_version":null,"sort":null,"highlight":null,"_explanation":null,"group_model":"IS"}

....

--
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.

--
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.

I meant also to wrap in constant_score?

simon

On Monday, March 11, 2013 10:07:04 PM UTC+1, Victor wrote:

got the same result:
with added options:

curl -X GET '
http://localhost:9200/manufactured_tires/manufactured_tire/_search?from=0&size=1&pretty'
-d '{"filter":{"missing": {"field": "group_model", "null_value": true,
"existence": true}}}'

On Mon, Mar 11, 2013 at 1:33 PM, simonw <simon.w...@elasticsearch.com<javascript:>

wrote:

can you try

{
"constant_score" : {

    "filter" : {

        "missing" : { 

            "field" : "group_model",

            "existence" : true,

            "null_value" : true

        }
    }

}

}

On Monday, March 11, 2013 7:36:35 PM UTC+1, Victor wrote:

I want to query the group_moel field that contains null value, but i am
not getting the right result:
group_model is a field using default mapping setting. the result have
records which group_model = "IS"

curl -X GET 'http://localhost:9200/manufactured_tires/
manufactured_tire/_search?**from=0&size=100&pretty'http://localhost:9200/manufactured_tires/manufactured_tire/_search?from=0&size=100&pretty' -d
'{"filter":{"missing": {"field": "group_model", "null_value": null}}}'

Result:
{
"took" : 1,
"timed_out" : false,
"shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 9,
"max_score" : 1.0,
"hits" : [ {
"index" : "manufactured_tires-2013-03-04",
"_type" : "manufactured_tire",
"_id" : "6f0gOX7sRZu1gQjZUhlgXA",
"_score" : 1.0, "source" : {"aspect_ratio":"40","car

designation":"E","load_range":"","load_rating_index":"93","make":"LEXUS","model":"IS
F Base","primary_secondary":"1",
"radial_construction":"R","

rim_diameter":"19","section
width":"225","speed_rating":"
Y","tire_designation":"1","**tire_size":"225/40R19","year":**2011,"id":"
**6f0gOX7sRZu1gQjZUhlgXA","
type":"manufactured_tire","_
score":0.0,"_index":"manufactured_tires-2013-03-04"
,"_version":null,"sort":null,"highlight":null,"_explanation":null,"group_model":"IS"}

}, { 
  "_index" : "manufactured_tires-2013-03-**04", 
  "_type" : "manufactured_tire", 
  "_id" : "ep9IXrlOR4Sqvek5c41HQg", 
  "_score" : 1.0, "_source" : {"aspect_ratio":"35","car_**

designation":"E","load_range":"","load_rating_index":"96","make":"LEXUS","model":"IS
F Base","primary_secondary":"1",
"radial_construction":"R","

rim_diameter":"19","section_width":"255","speed_rating":"
Y","tire_designation":"2","**tire_size":"255/35R19","year":**2009,"id":"
ep9IXrlOR4Sqvek5c41HQg","**type":"manufactured_tire","
score":0.0,"_index":"manufactured_tires-2013-03-04"
,"_version":null,"sort":null,"highlight":null,"_explanation":null,"group_model":"IS"}

....

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

I think the issue is related to mapping setting, in which the group_model
will be analyzed. "IS" is the stop words, so it got tokenized away. if i
changed to be "not_analyzed" the issue goes away

Vic

On Mon, Mar 11, 2013 at 2:15 PM, simonw
simon.willnauer@elasticsearch.comwrote:

I meant also to wrap in constant_score?

simon

On Monday, March 11, 2013 10:07:04 PM UTC+1, Victor wrote:

got the same result:
with added options:

curl -X GET 'http://localhost:9200/manufactured_tires/
manufactured_tire/_search?**from=0&size=1&prettyhttp://localhost:9200/manufactured_tires/manufactured_tire/_search?from=0&size=1&pretty'
-d '{"filter":{"missing": {"field": "group_model", "null_value": true,
"existence": true}}}'

On Mon, Mar 11, 2013 at 1:33 PM, simonw <simon.w...@**elasticsearch.com>wrote:

can you try

{
"constant_score" : {

    "filter" : {

        "missing" : {

            "field" : "group_model",

            "existence" : true,

            "null_value" : true

        }
    }

}

}

On Monday, March 11, 2013 7:36:35 PM UTC+1, Victor wrote:

I want to query the group_moel field that contains null value, but i am
not getting the right result:
group_model is a field using default mapping setting. the result have
records which group_model = "IS"

curl -X GET 'http://localhost:9200/manufactured_tires/**
manufactured_tire/**_search?**from=0&size=100&**pretty'http://localhost:9200/manufactured_tires/manufactured_tire/_search?from=0&size=100&pretty' -d
'{"filter":{"missing": {"field": "group_model", "null_value": null}}}'

Result:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 9,
"max_score" : 1.0,
"hits" : [ {
"_index" : "manufactured_tires-2013-03-04",
"type" : "manufactured_tire",
"id" : "6f0gOX7sRZu1gQjZUhlgXA",
"score" : 1.0, "source" : {"aspect_ratio":"40","cardesi
gnation":"E","load_range":**"","**load_rating_index":"93","make":"LEXUS","model":"IS
F Base","primary_secondary":"1",****"radial_construction":"R","rim
diameter":"19","sectionwidth":"225","speed_rating":"Y","
tire_designation":"1","**tire
**size":"225/40R19","year":2011,
"id":"6f0gOX7sRZu1gQjZUhlgXA","
**type":"manufactured_tire","
****
score":0.0,"index":"manufactured_tires-2013-03-04"**,"**
version":null,"sort":null,"highlight":null,"_explanation"**:**null,"group_model":"IS"}

}, {
  "_index" : "manufactured_tires-2013-03-**04**",
  "_type" : "manufactured_tire",
  "_id" : "ep9IXrlOR4Sqvek5c41HQg",
  "_score" : 1.0, "_source" : {"aspect_ratio":"35","car_**desi**

gnation":"E","load_range":"","load_rating_index":"96","make":"LEXUS","model":"IS
F Base","primary_secondary":"1",****"radial_construction":"R","rim
diameter":"19","sectionwidth":"255","speed_rating":"Y","
tire_designation":"2","tire_size":"255/35R19","year":2009,
"id":"ep9IXrlOR4Sqvek5c41HQg","**type":"manufactured_tire","

score":0.0,"_index":"manufactured_tires-2013-03-04"
,"_

version":null,"sort":null,"highlight":null,"_explanation"**:**null,"group_model":"IS"}

....

--
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.

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