Missing field in a filter

I am working on a query to do some searching between
multiple indexes with different fields and I am having an issue with the
location filter. In the query I was hoping that an or filter with a
missing clause would solve this but I am still getting the error.

The bool statements with the exists clause in the query section fixes this
issue but I have not been able to fine a way to work around it in the
filters section. I have tried every combination I can think of with and,
or and bool to get this to work.

The error message that I am getting is "QueryParsingException[[]
failed to find geo_point field [location.lat_lon]".

Can anyone help me out?

Thank you,
Stefanie

My query looks something like this:

{
"query": {
"custom_filters_score": {
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"query_string": {
"query": "exists:title"
}
},
{
"query_string": {
"query": "title:Dallas",
"boost": 2.0
}
}
]
}
},
{
"bool": {
"must": [
{
"query_string": {
"query": "exists:description"
}
},
{
"query_string": {
"query": "description:Dallas",
"boost": 2.0
}
}
]
}
}
],
"minimum_number_should_match": 1
}
},
"filters": [
{
"filter": {
"or": [
{
"missing": {
"field": "location.lat_lon"
}
},
{
"geo_distance": {
"distance": "50mi",
"location.lat_lon": [
-96.795402,
32.778149
]
}
}
]
},
"boost": 2.0
}
]
}
},
"size": 20,
"from": 0
}

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

On Mon, 2013-03-18 at 18:48 -0700, Stefanie wrote:

I am working on a query to do some searching between multiple indexes
with different fields and I am having an issue with the location
filter. In the query I was hoping that an or filter with a missing
clause would solve this but I am still getting the error.

I think you're looking in the wrong place - it's not the missing clause
that is the problem. It's the geo_point field that is not mapped as
such.

To demonstrate that this works correctly:

curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
"mappings" : {
"foo" : {
"properties" : {
"loc" : {
"type" : "geo_point"
}
}
}
}
}
'

One doc with a loc

curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1' -d '
{
"loc" : [
0,
0
],
"text" : "xxx"
}
'

One doc without a loc, in the same type

curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1' -d '
{
"text" : "xxx"
}
'

One doc without a loc, in a different type

curl -XPOST 'http://127.0.0.1:9200/test/bar?pretty=1' -d '
{
"text" : "xxx"
}
'

Search across all types:

curl -XGET 'http://127.0.0.1:9200/test/_search?pretty=1' -d '
{
"query" : {
"filtered" : {
"filter" : {
"geo_distance" : {
"distance" : "5km",
"loc" : [
0,
0
]
}
},
"query" : {
"match_all" : {}
}
}
}
}
'

{

"hits" : {

"hits" : [

{

"_source" : {

"text" : "xxx",

"loc" : [

0,

0

]

},

"_score" : 1,

"_index" : "test",

"_id" : "ZB_XJ4FjQxOYGCMbmXHM1g",

"_type" : "foo"

}

],

"max_score" : 1,

"total" : 1

},

"timed_out" : false,

"_shards" : {

"failed" : 0,

"successful" : 5,

"total" : 5

},

"took" : 4

}

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

Clinton,
Thank you for the reply.

My issue I am having is not with my mapping but that I am searching across
multiple indexes and not all
of them has the location.lat_log field. I want the filter to come back
true for the indexes that have the field is within
the range or if the index does not have the field. If I only run the query
for the indexes with the location.lat_lon field I do
not get any errors but when the query is run across all of the indexes it
fails on the once where the field does not exist.
I am using alias to group multiple indexes together and I do not want to
have to add unnecessary fields or run multiple
queries if I do not need to.

I do not have this issue when I do something similar in the query section,
using something like this where the field title
is not in all of my indexes:

"bool": {
"must": [
{
"query_string": {
"query": "exists:title"
}
},
{
"query_string": {
"query": "title:Dallas",
"boost": 2.0
}
}
]
}

Thank you,
Stefanie

On Tuesday, March 19, 2013 7:43:51 AM UTC-4, Clinton Gormley wrote:

On Mon, 2013-03-18 at 18:48 -0700, Stefanie wrote:

I am working on a query to do some searching between multiple indexes
with different fields and I am having an issue with the location
filter. In the query I was hoping that an or filter with a missing
clause would solve this but I am still getting the error.

I think you're looking in the wrong place - it's not the missing clause
that is the problem. It's the geo_point field that is not mapped as
such.

To demonstrate that this works correctly:

curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
"mappings" : {
"foo" : {
"properties" : {
"loc" : {
"type" : "geo_point"
}
}
}
}
}
'

One doc with a loc

curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1' -d '
{
"loc" : [
0,
0
],
"text" : "xxx"
}
'

One doc without a loc, in the same type

curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1' -d '
{
"text" : "xxx"
}
'

One doc without a loc, in a different type

curl -XPOST 'http://127.0.0.1:9200/test/bar?pretty=1' -d '
{
"text" : "xxx"
}
'

Search across all types:

curl -XGET 'http://127.0.0.1:9200/test/_search?pretty=1' -d '
{
"query" : {
"filtered" : {
"filter" : {
"geo_distance" : {
"distance" : "5km",
"loc" : [
0,
0
]
}
},
"query" : {
"match_all" : {}
}
}
}
}
'

{

"hits" : {

"hits" : [

{

"_source" : {

"text" : "xxx",

"loc" : [

0,

0

]

},

"_score" : 1,

"_index" : "test",

"_id" : "ZB_XJ4FjQxOYGCMbmXHM1g",

"_type" : "foo"

}

],

"max_score" : 1,

"total" : 1

},

"timed_out" : false,

"_shards" : {

"failed" : 0,

"successful" : 5,

"total" : 5

},

"took" : 4

}

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

Hi Stefanie

Clinton,
Thank you for the reply.

My issue I am having is not with my mapping but that I am searching
across multiple indexes and not all
of them has the location.lat_log field. I want the filter to come
back true for the indexes that have the field is within
the range or if the index does not have the field. If I only run the
query for the indexes with the location.lat_lon field I do
not get any errors but when the query is run across all of the indexes
it fails on the once where the field does not exist.
I am using alias to group multiple indexes together and I do not want
to have to add unnecessary fields or run multiple
queries if I do not need to.

I do not have this issue when I do something similar in the query
section, using something like this where the field title
is not in all of my indexes:

Please reread my email. The problem is not what you think it is, as i
demonstrated with my example below

On Tuesday, March 19, 2013 7:43:51 AM UTC-4, Clinton Gormley wrote:
On Mon, 2013-03-18 at 18:48 -0700, Stefanie wrote:
> I am working on a query to do some searching between
multiple indexes
> with different fields and I am having an issue with the
location
> filter. In the query I was hoping that an or filter with a
missing
> clause would solve this but I am still getting the error.

    I think you're looking in the wrong place - it's not the
    missing clause 
    that is the problem. It's the geo_point field that is not
    mapped as 
    such. 
    
    To demonstrate that this works correctly: 
    
    curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1'  -d ' 
    { 
       "mappings" : { 
          "foo" : { 
             "properties" : { 
                "loc" : { 
                   "type" : "geo_point" 
                } 
             } 
          } 
       } 
    } 
    ' 
    
    # One doc with a loc 
    curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1'  -d ' 
    { 
       "loc" : [ 
          0, 
          0 
       ], 
       "text" : "xxx" 
    } 
    ' 
    
    # One doc without a loc, in the same type 
    curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1'  -d ' 
    { 
       "text" : "xxx" 
    } 
    ' 
    
    # One doc without a loc, in a different type 
    curl -XPOST 'http://127.0.0.1:9200/test/bar?pretty=1'  -d ' 
    { 
       "text" : "xxx" 
    } 
    ' 
    
    
    # Search across all types: 
    
    curl -XGET 'http://127.0.0.1:9200/test/_search?pretty=1'  -d
    ' 
    { 
       "query" : { 
          "filtered" : { 
             "filter" : { 
                "geo_distance" : { 
                   "distance" : "5km", 
                   "loc" : [ 
                      0, 
                      0 
                   ] 
                } 
             }, 
             "query" : { 
                "match_all" : {} 
             } 
          } 
       } 
    } 
    ' 
    
    # { 
    #    "hits" : { 
    #       "hits" : [ 
    #          { 
    #             "_source" : { 
    #                "text" : "xxx", 
    #                "loc" : [ 
    #                   0, 
    #                   0 
    #                ] 
    #             }, 
    #             "_score" : 1, 
    #             "_index" : "test", 
    #             "_id" : "ZB_XJ4FjQxOYGCMbmXHM1g", 
    #             "_type" : "foo" 
    #          } 
    #       ], 
    #       "max_score" : 1, 
    #       "total" : 1 
    #    }, 
    #    "timed_out" : false, 
    #    "_shards" : { 
    #       "failed" : 0, 
    #       "successful" : 5, 
    #       "total" : 5 
    #    }, 
    #    "took" : 4 
    # } 

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

Clinton,

The setup that I have is:

index test1
curl -X POST http://localhost:9200/test1 -d '{
"mappings": {
"a": {
"properties": {
"id": {
"type": "string",
"index": "not_analyzed",
"include_in_all": true
},
"title": {
"type": "string",
"analyzer": "snowball",
"boost": 2.0
},
"description": {
"type": "string",
"analyzer": "snowball"
}
}
}
}
}'

index test2
curl -X POST http://localhost:9200/test2 -d '{
"mappings": {
"b": {
"properties": {
"id": {
"type": "string",
"index": "not_analyzed",
"include_in_all": true
},
"description": {
"type": "string",
"analyzer": "snowball",
"boost": 2.0
},
"location": {
"properties": {
"lat_lon": {
"type": "geo_point",
"lat_lon": true
}
}
}
}
}
}
}'

my alias is set up as
curl -X POST "http://localhost:9200/_aliases" -d '{
"actions":[
{"add":{
"index":"test1",
"alias":"u1"
}
},
{"add":{
"index":"test2",
"alias":"u1"
}
}
]
}'

I am running my query against the alias and what I am looking for is test1
that matches "Dallas" in title or description and test2 that matches
"Dallas" in description or location.lat_lon within 50 miles of [-96.795402,
32.778149]. The boolean in the query section works so that I do not get an
error when test2 does not have the field title but is does not work within
the filters section when test1 does not have the field location.lat_lon.
If I run the query against just test2 I do not get any errors.

Thank you,
Stefanie

On Tuesday, March 19, 2013 3:34:50 PM UTC-4, Clinton Gormley wrote:

Hi Stefanie

Clinton,
Thank you for the reply.

My issue I am having is not with my mapping but that I am searching
across multiple indexes and not all
of them has the location.lat_log field. I want the filter to come
back true for the indexes that have the field is within
the range or if the index does not have the field. If I only run the
query for the indexes with the location.lat_lon field I do
not get any errors but when the query is run across all of the indexes
it fails on the once where the field does not exist.
I am using alias to group multiple indexes together and I do not want
to have to add unnecessary fields or run multiple
queries if I do not need to.

I do not have this issue when I do something similar in the query
section, using something like this where the field title
is not in all of my indexes:

Please reread my email. The problem is not what you think it is, as i
demonstrated with my example below

On Tuesday, March 19, 2013 7:43:51 AM UTC-4, Clinton Gormley wrote:
On Mon, 2013-03-18 at 18:48 -0700, Stefanie wrote:
> I am working on a query to do some searching between
multiple indexes
> with different fields and I am having an issue with the
location
> filter. In the query I was hoping that an or filter with a
missing
> clause would solve this but I am still getting the error.

    I think you're looking in the wrong place - it's not the 
    missing clause 
    that is the problem. It's the geo_point field that is not 
    mapped as 
    such. 
    
    To demonstrate that this works correctly: 
    
    curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1'  -d ' 
    { 
       "mappings" : { 
          "foo" : { 
             "properties" : { 
                "loc" : { 
                   "type" : "geo_point" 
                } 
             } 
          } 
       } 
    } 
    ' 
    
    # One doc with a loc 
    curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1'  -d ' 
    { 
       "loc" : [ 
          0, 
          0 
       ], 
       "text" : "xxx" 
    } 
    ' 
    
    # One doc without a loc, in the same type 
    curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1'  -d ' 
    { 
       "text" : "xxx" 
    } 
    ' 
    
    # One doc without a loc, in a different type 
    curl -XPOST 'http://127.0.0.1:9200/test/bar?pretty=1'  -d ' 
    { 
       "text" : "xxx" 
    } 
    ' 
    
    
    # Search across all types: 
    
    curl -XGET 'http://127.0.0.1:9200/test/_search?pretty=1'  -d 
    ' 
    { 
       "query" : { 
          "filtered" : { 
             "filter" : { 
                "geo_distance" : { 
                   "distance" : "5km", 
                   "loc" : [ 
                      0, 
                      0 
                   ] 
                } 
             }, 
             "query" : { 
                "match_all" : {} 
             } 
          } 
       } 
    } 
    ' 
    
    # { 
    #    "hits" : { 
    #       "hits" : [ 
    #          { 
    #             "_source" : { 
    #                "text" : "xxx", 
    #                "loc" : [ 
    #                   0, 
    #                   0 
    #                ] 
    #             }, 
    #             "_score" : 1, 
    #             "_index" : "test", 
    #             "_id" : "ZB_XJ4FjQxOYGCMbmXHM1g", 
    #             "_type" : "foo" 
    #          } 
    #       ], 
    #       "max_score" : 1, 
    #       "total" : 1 
    #    }, 
    #    "timed_out" : false, 
    #    "_shards" : { 
    #       "failed" : 0, 
    #       "successful" : 5, 
    #       "total" : 5 
    #    }, 
    #    "took" : 4 
    # } 

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

Hi Stefanie

Whole hearted apologies - I was incorrect.

It does indeed fail if the field is not in the mapping of whichever
index it looks at first (which varies per shard and per run)

please open an issue for this

thanks

Clint

On Tue, 2013-03-19 at 13:10 -0700, Stefanie wrote:

Clinton,

The setup that I have is:

index test1
curl -X POST http://localhost:9200/test1 -d '{
"mappings": {
"a": {
"properties": {
"id": {
"type": "string",
"index": "not_analyzed",
"include_in_all": true
},
"title": {
"type": "string",
"analyzer": "snowball",
"boost": 2.0
},
"description": {
"type": "string",
"analyzer": "snowball"
}
}
}
}
}'

index test2
curl -X POST http://localhost:9200/test2 -d '{
"mappings": {
"b": {
"properties": {
"id": {
"type": "string",
"index": "not_analyzed",
"include_in_all": true
},
"description": {
"type": "string",
"analyzer": "snowball",
"boost": 2.0
},
"location": {
"properties": {
"lat_lon": {
"type": "geo_point",
"lat_lon": true
}
}
}
}
}
}
}'

my alias is set up as
curl -X POST "http://localhost:9200/_aliases" -d '{
"actions":[
{"add":{
"index":"test1",
"alias":"u1"
}
},
{"add":{
"index":"test2",
"alias":"u1"
}
}
]
}'

I am running my query against the alias and what I am looking for is
test1 that matches "Dallas" in title or description and test2 that
matches "Dallas" in description or location.lat_lon within 50 miles
of [-96.795402, 32.778149]. The boolean in the query section works so
that I do not get an error when test2 does not have the field title
but is does not work within the filters section when test1 does not
have the field location.lat_lon. If I run the query against just
test2 I do not get any errors.

Thank you,
Stefanie

On Tuesday, March 19, 2013 3:34:50 PM UTC-4, Clinton Gormley wrote:
Hi Stefanie

    > Clinton, 
    > Thank you for the reply. 
    > 
    > 
    > My issue I am having is not with my mapping but that I am
    searching 
    > across multiple indexes and not all 
    > of them has the location.lat_log field.  I want the filter
    to come 
    > back true for the indexes that have the field is within 
    > the range or if the index does not have the field.  If I
    only run the 
    > query for the indexes with the location.lat_lon field I do 
    > not get any errors but when the query is run across all of
    the indexes 
    > it fails on the once where the field does not exist.   
    > I am using alias to group multiple indexes together and I do
    not want 
    > to have to add unnecessary fields or run multiple 
    > queries if I do not need to.   
    > 
    > 
    > I do not have this issue when I do something similar in the
    query 
    > section, using something like this where the field title 
    > is not in all of my indexes: 
    
    Please reread my email.  The problem is not what you think it
    is, as i 
    demonstrated with my example below 
    
    > 
    > On Tuesday, March 19, 2013 7:43:51 AM UTC-4, Clinton Gormley
    wrote: 
    >         On Mon, 2013-03-18 at 18:48 -0700, Stefanie wrote: 
    >         > I am working on a query to do some searching
    between 
    >         multiple indexes 
    >         > with different fields and I am having an issue
    with the 
    >         location 
    >         > filter.   In the query I was hoping that an or
    filter with a 
    >         missing 
    >         > clause would solve this but I am still getting the
    error.   
    >         
    >         I think you're looking in the wrong place - it's not
    the 
    >         missing clause 
    >         that is the problem. It's the geo_point field that
    is not 
    >         mapped as 
    >         such. 
    >         
    >         To demonstrate that this works correctly: 
    >         
    >         curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1'
     -d ' 
    >         { 
    >            "mappings" : { 
    >               "foo" : { 
    >                  "properties" : { 
    >                     "loc" : { 
    >                        "type" : "geo_point" 
    >                     } 
    >                  } 
    >               } 
    >            } 
    >         } 
    >         ' 
    >         
    >         # One doc with a loc 
    >         curl -XPOST
    'http://127.0.0.1:9200/test/foo?pretty=1'  -d ' 
    >         { 
    >            "loc" : [ 
    >               0, 
    >               0 
    >            ], 
    >            "text" : "xxx" 
    >         } 
    >         ' 
    >         
    >         # One doc without a loc, in the same type 
    >         curl -XPOST
    'http://127.0.0.1:9200/test/foo?pretty=1'  -d ' 
    >         { 
    >            "text" : "xxx" 
    >         } 
    >         ' 
    >         
    >         # One doc without a loc, in a different type 
    >         curl -XPOST
    'http://127.0.0.1:9200/test/bar?pretty=1'  -d ' 
    >         { 
    >            "text" : "xxx" 
    >         } 
    >         ' 
    >         
    >         
    >         # Search across all types: 
    >         
    >         curl -XGET
    'http://127.0.0.1:9200/test/_search?pretty=1'  -d 
    >         ' 
    >         { 
    >            "query" : { 
    >               "filtered" : { 
    >                  "filter" : { 
    >                     "geo_distance" : { 
    >                        "distance" : "5km", 
    >                        "loc" : [ 
    >                           0, 
    >                           0 
    >                        ] 
    >                     } 
    >                  }, 
    >                  "query" : { 
    >                     "match_all" : {} 
    >                  } 
    >               } 
    >            } 
    >         } 
    >         ' 
    >         
    >         # { 
    >         #    "hits" : { 
    >         #       "hits" : [ 
    >         #          { 
    >         #             "_source" : { 
    >         #                "text" : "xxx", 
    >         #                "loc" : [ 
    >         #                   0, 
    >         #                   0 
    >         #                ] 
    >         #             }, 
    >         #             "_score" : 1, 
    >         #             "_index" : "test", 
    >         #             "_id" : "ZB_XJ4FjQxOYGCMbmXHM1g", 
    >         #             "_type" : "foo" 
    >         #          } 
    >         #       ], 
    >         #       "max_score" : 1, 
    >         #       "total" : 1 
    >         #    }, 
    >         #    "timed_out" : false, 
    >         #    "_shards" : { 
    >         #       "failed" : 0, 
    >         #       "successful" : 5, 
    >         #       "total" : 5 
    >         #    }, 
    >         #    "took" : 4 
    >         # } 
    >         
    >         
    >         
    > 
    > -- 
    > 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_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.

No problem.

The issue number is 2801

Stefanie

On Tuesday, March 19, 2013 4:32:10 PM UTC-4, Clinton Gormley wrote:

Hi Stefanie

Whole hearted apologies - I was incorrect.

It does indeed fail if the field is not in the mapping of whichever
index it looks at first (which varies per shard and per run)

please open an issue for this

thanks

Clint

On Tue, 2013-03-19 at 13:10 -0700, Stefanie wrote:

Clinton,

The setup that I have is:

index test1
curl -X POST http://localhost:9200/test1 -d '{
"mappings": {
"a": {
"properties": {
"id": {
"type": "string",
"index": "not_analyzed",
"include_in_all": true
},
"title": {
"type": "string",
"analyzer": "snowball",
"boost": 2.0
},
"description": {
"type": "string",
"analyzer": "snowball"
}
}
}
}
}'

index test2
curl -X POST http://localhost:9200/test2 -d '{
"mappings": {
"b": {
"properties": {
"id": {
"type": "string",
"index": "not_analyzed",
"include_in_all": true
},
"description": {
"type": "string",
"analyzer": "snowball",
"boost": 2.0
},
"location": {
"properties": {
"lat_lon": {
"type": "geo_point",
"lat_lon": true
}
}
}
}
}
}
}'

my alias is set up as
curl -X POST "http://localhost:9200/_aliases" -d '{
"actions":[
{"add":{
"index":"test1",
"alias":"u1"
}
},
{"add":{
"index":"test2",
"alias":"u1"
}
}
]
}'

I am running my query against the alias and what I am looking for is
test1 that matches "Dallas" in title or description and test2 that
matches "Dallas" in description or location.lat_lon within 50 miles
of [-96.795402, 32.778149]. The boolean in the query section works so
that I do not get an error when test2 does not have the field title
but is does not work within the filters section when test1 does not
have the field location.lat_lon. If I run the query against just
test2 I do not get any errors.

Thank you,
Stefanie

On Tuesday, March 19, 2013 3:34:50 PM UTC-4, Clinton Gormley wrote:
Hi Stefanie

    > Clinton, 
    > Thank you for the reply. 
    > 
    > 
    > My issue I am having is not with my mapping but that I am 
    searching 
    > across multiple indexes and not all 
    > of them has the location.lat_log field.  I want the filter 
    to come 
    > back true for the indexes that have the field is within 
    > the range or if the index does not have the field.  If I 
    only run the 
    > query for the indexes with the location.lat_lon field I do 
    > not get any errors but when the query is run across all of 
    the indexes 
    > it fails on the once where the field does not exist.   
    > I am using alias to group multiple indexes together and I do 
    not want 
    > to have to add unnecessary fields or run multiple 
    > queries if I do not need to.   
    > 
    > 
    > I do not have this issue when I do something similar in the 
    query 
    > section, using something like this where the field title 
    > is not in all of my indexes: 
    
    Please reread my email.  The problem is not what you think it 
    is, as i 
    demonstrated with my example below 
    
    > 
    > On Tuesday, March 19, 2013 7:43:51 AM UTC-4, Clinton Gormley 
    wrote: 
    >         On Mon, 2013-03-18 at 18:48 -0700, Stefanie wrote: 
    >         > I am working on a query to do some searching 
    between 
    >         multiple indexes 
    >         > with different fields and I am having an issue 
    with the 
    >         location 
    >         > filter.   In the query I was hoping that an or 
    filter with a 
    >         missing 
    >         > clause would solve this but I am still getting the 
    error.   
    >         
    >         I think you're looking in the wrong place - it's not 
    the 
    >         missing clause 
    >         that is the problem. It's the geo_point field that 
    is not 
    >         mapped as 
    >         such. 
    >         
    >         To demonstrate that this works correctly: 
    >         
    >         curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' 
     -d ' 
    >         { 
    >            "mappings" : { 
    >               "foo" : { 
    >                  "properties" : { 
    >                     "loc" : { 
    >                        "type" : "geo_point" 
    >                     } 
    >                  } 
    >               } 
    >            } 
    >         } 
    >         ' 
    >         
    >         # One doc with a loc 
    >         curl -XPOST 
    'http://127.0.0.1:9200/test/foo?pretty=1'  -d ' 
    >         { 
    >            "loc" : [ 
    >               0, 
    >               0 
    >            ], 
    >            "text" : "xxx" 
    >         } 
    >         ' 
    >         
    >         # One doc without a loc, in the same type 
    >         curl -XPOST 
    'http://127.0.0.1:9200/test/foo?pretty=1'  -d ' 
    >         { 
    >            "text" : "xxx" 
    >         } 
    >         ' 
    >         
    >         # One doc without a loc, in a different type 
    >         curl -XPOST 
    'http://127.0.0.1:9200/test/bar?pretty=1'  -d ' 
    >         { 
    >            "text" : "xxx" 
    >         } 
    >         ' 
    >         
    >         
    >         # Search across all types: 
    >         
    >         curl -XGET 
    'http://127.0.0.1:9200/test/_search?pretty=1'  -d 
    >         ' 
    >         { 
    >            "query" : { 
    >               "filtered" : { 
    >                  "filter" : { 
    >                     "geo_distance" : { 
    >                        "distance" : "5km", 
    >                        "loc" : [ 
    >                           0, 
    >                           0 
    >                        ] 
    >                     } 
    >                  }, 
    >                  "query" : { 
    >                     "match_all" : {} 
    >                  } 
    >               } 
    >            } 
    >         } 
    >         ' 
    >         
    >         # { 
    >         #    "hits" : { 
    >         #       "hits" : [ 
    >         #          { 
    >         #             "_source" : { 
    >         #                "text" : "xxx", 
    >         #                "loc" : [ 
    >         #                   0, 
    >         #                   0 
    >         #                ] 
    >         #             }, 
    >         #             "_score" : 1, 
    >         #             "_index" : "test", 
    >         #             "_id" : "ZB_XJ4FjQxOYGCMbmXHM1g", 
    >         #             "_type" : "foo" 
    >         #          } 
    >         #       ], 
    >         #       "max_score" : 1, 
    >         #       "total" : 1 
    >         #    }, 
    >         #    "timed_out" : false, 
    >         #    "_shards" : { 
    >         #       "failed" : 0, 
    >         #       "successful" : 5, 
    >         #       "total" : 5 
    >         #    }, 
    >         #    "took" : 4 
    >         # } 
    >         
    >         
    >         
    > 
    > -- 
    > 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_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 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.