Nested geo-point mapping and querying

I have indexed document in my elastic search. Here is the mapping :

{
"offers": {
"offer": {
"properties": {
"company": {
"dynamic": "true",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"description": {
"type": "string"
},
"location": {

  • "type": "nested",*
  • "properties": {*
  • "id": {*
  • "type": "string"*
  • },*
  • "name": {*
  • "type": "string"*
  • },*
  • "pin": {*
  • "type": "geo_point"*
  • }*
  • }*
  • }*,
    "publicationDate": {
    "type": "long",
    "ignore_malformed": false
    },
    "title": {
    "type": "string"
    }
    }
    }
    }
    }

My problem is with the location/pin field. I would like to run a query like
this :
{
"query": {
"match_all" : { }

},
"filter" : {
        "geo_distance" : {
            "distance" : "5000km",
            "location.pin" : {"lat":45.75,"lon":4.85}
        }
    }

}

I have no hits ... I'm missing something or I don't use nested type
correctly ... or ... I don't know :slight_smile:

Can I have some help about this ?

--

I have no hits ... I'm missing something or I don't use nested type
correctly ... or ... I don't know :slight_smile:

Nested objects need to be queried with nested query or nested filter

clint

Can I have some help about this ?

--

--

ok ... removing *"type": "nested" *solved the pb. I was not using nested
for the right thing ....
thx

On Wednesday, October 17, 2012 4:40:52 PM UTC+2, fmarchand wrote:

I have indexed document in my Elasticsearch. Here is the mapping :

{
"offers": {
"offer": {
"properties": {
"company": {
"dynamic": "true",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"description": {
"type": "string"
},
"location": {

  • "type": "nested",*
  • "properties": {*
  • "id": {*
  • "type": "string"*
  • },*
  • "name": {*
  • "type": "string"*
  • },*
  • "pin": {*
  • "type": "geo_point"*
  • }*
  • }*
  • }*,
    "publicationDate": {
    "type": "long",
    "ignore_malformed": false
    },
    "title": {
    "type": "string"
    }
    }
    }
    }
    }

My problem is with the location/pin field. I would like to run a query
like this :
{
"query": {
"match_all" : { }

},
"filter" : {
        "geo_distance" : {
            "distance" : "5000km",
            "location.pin" : {"lat":45.75,"lon":4.85}
        }
    }

}

I have no hits ... I'm missing something or I don't use nested type
correctly ... or ... I don't know :slight_smile:

Can I have some help about this ?

--

Yes, you're right :slight_smile:

Is nested query used for objects in an array ? like a query on a list of
objects ?

I will try to read more about it ...

Thx !

On Wednesday, October 17, 2012 4:46:30 PM UTC+2, Clinton Gormley wrote:

I have no hits ... I'm missing something or I don't use nested type
correctly ... or ... I don't know :slight_smile:

Nested objects need to be queried with nested query or nested filter

clint

Can I have some help about this ?

--

--