Jim_2  
                (Jim-2)
               
                 
              
                  
                    March 8, 2012,  3:27pm
                   
                   
              1 
               
             
            
              I've indexed a document like below:
curl -XPUT 'http://localhost:9200/people/person/1 ' -d' 
{ 
"locations": [ 
{ 
"location": "51.0587013,-2.9499066", 
"id": 1 
}, 
{ 
"location": "51.38596454,-2.36162306118", 
"id": 2 
} 
] 
}'
mapped the 'location' field to geo_point with:
curl -XPUT 'http://localhost:9200/people/person/_mapping ? 
ignore_conflicts=true' -d' 
{ 
"person":{ 
"properties": { 
"locations": { 
"properties": { 
"location": { 
"type": "geo_point" 
} 
} 
} 
} 
} 
}'
I want to search so I can supply several geo_points and receive 
results which have (at least) one location near any of the points I 
supply.
I've tried several things, none of which work, for example:
curl -XGET 'http://localhost:9200/people/person/_search ' -d' 
{ 
"query": { 
"filtered": { 
"filter": { 
"not": { 
"ids": { 
"values": [ 
2 
] 
} 
}, 
"geo_distance": { 
"distance": "500mi", 
"locations.location": 
["51.38596452,-2.36162306116", "51.0587015,-2.9499065"] 
} 
} 
} 
} 
}'
I just get an exception like:
nested: QueryParsingException[[people] [_na] filter malformed, no 
field after start_object
How can I do this?
Thanks, 
Jim
             
            
               
               
               
            
            
           
          
            
              
                Eric_Jain  
                (Eric Jain)
               
              
                  
                    March 9, 2012,  7:46pm
                   
                   
              2 
               
             
            
              On Mar 8, 7:27 am, Jim beanb...@googlemail.com  wrote:
I want to search so I can supply several geo_points and receive 
results which have (at least) one location near any of the points I 
supply.
 
I don't know if the geo_distance filter supports searches for more 
than one geo_point at a time. But you could combine multiple filters 
using a bool 'should' filter.
Also, to handle multiple geo_points per document, you may need to 
index geohashes instead of lat and long.
             
            
               
               
               
            
            
           
          
            
              
                egaumer  
                (egaumer)
               
                 
              
                  
                    March 9, 2012,  8:58pm
                   
                   
              3 
               
             
            
              You haven't specified a proper nested mapping. Have a look here -
  
  
    
  Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.
   
  
    
    
  
  
 
-Eric
On Thursday, March 8, 2012 10:27:08 AM UTC-5, Jim wrote:
I've indexed a document like below:
curl -XPUT 'http://localhost:9200/people/person/1 ' -d' 
{ 
"locations": [ 
{ 
"location": "51.0587013,-2.9499066", 
"id": 1 
}, 
{ 
"location": "51.38596454,-2.36162306118", 
"id": 2 
} 
] 
}'
mapped the 'location' field to geo_point with:
curl -XPUT 'http://localhost:9200/people/person/_mapping ? 
ignore_conflicts=truehttp://localhost:9200/people/person/_mapping?ignore_conflicts=true ' 
-d' 
{ 
"person":{ 
"properties": { 
"locations": { 
"properties": { 
"location": { 
"type": "geo_point" 
} 
} 
} 
} 
} 
}'
I want to search so I can supply several geo_points and receive 
results which have (at least) one location near any of the points I 
supply.
I've tried several things, none of which work, for example:
curl -XGET 'http://localhost:9200/people/person/_search ' -d' 
{ 
"query": { 
"filtered": { 
"filter": { 
"not": { 
"ids": { 
"values": [ 
2 
] 
} 
}, 
"geo_distance": { 
"distance": "500mi", 
"locations.location": 
["51.38596452,-2.36162306116", "51.0587015,-2.9499065"] 
} 
} 
} 
} 
}'
I just get an exception like:
nested: QueryParsingException[[people] [_na] filter malformed, no 
field after start_object
How can I do this?
Thanks, 
Jim
 
             
            
               
               
               
            
            
           
          
            
              
                Jim_2  
                (Jim-2)
               
              
                  
                    March 14, 2012,  2:33pm
                   
                   
              4 
               
             
            
              Thanks, I didn't understand nesting, but I get it now.
On Mar 9, 8:58 pm, egaumer egau...@gmail.com  wrote:
You haven't specified a proper nested mapping. Have a look here -Elasticsearch Platform — Find real-time answers at scale | Elastic 
-Eric
On Thursday, March 8, 2012 10:27:08 AM UTC-5, Jim wrote:
I've indexed a document like below:
 
curl -XPUT 'http://localhost:9200/people/person/1'-d'  
{ 
"locations": [ 
{ 
"location": "51.0587013,-2.9499066", 
"id": 1 
}, 
{ 
"location": "51.38596454,-2.36162306118", 
"id": 2 
} 
] 
}'
 
mapped the 'location' field to geo_point with:
 
curl -XPUT 'http://localhost:9200/people/person/_mapping ? 
ignore_conflicts=truehttp://localhost:9200/people/person/_mapping?ignore_conflicts=true ' 
-d' 
{ 
"person":{ 
"properties": { 
"locations": { 
"properties": { 
"location": { 
"type": "geo_point" 
} 
} 
} 
} 
} 
}'
 
I want to search so I can supply several geo_points and receive 
results which have (at least) one location near any of the points I 
supply.
 
I've tried several things, none of which work, for example:
 
curl -XGET 'http://localhost:9200/people/person/_search'-d'  
{ 
"query": { 
"filtered": { 
"filter": { 
"not": { 
"ids": { 
"values": [ 
2 
] 
} 
}, 
"geo_distance": { 
"distance": "500mi", 
"locations.location": 
["51.38596452,-2.36162306116", "51.0587015,-2.9499065"] 
} 
} 
} 
} 
}'
 
I just get an exception like:
 
nested: QueryParsingException[[people] [_na] filter malformed, no 
field after start_object
 
How can I do this?
 
Thanks, 
Jim