Having issues in elasticsearch geo_point search query in node js application

Hey there! Hope you doing fine. I'm working on node js (version 6.1.0 ) application and using elasticsearch (version 5.0.1) in it. But I'm having issues in geo_point query.
I'm doing mapping like this

client.indices.putMapping({
    index: 'newtesting',
    type: 'newtesting',
    body: {
        properties: {
            vendor_id: {type: "string", store: true},
            address: {type: "string", store: true},
            geoABC: {
                "store": true,
                "type": "geo_point",
                "lat_lon": true
            }
        }
    }
});

and inserting data like this

client.index({
                index: 'newtesting',
                type: 'newtesting',
                body: {
                    vendor_id: req.params.id,
                    address: req.params.address,
                    geoABC: {
                        "type": "Point",
                        "coordinates": [
                            req.params.lat,
                            req.params.lng
                        ]
                    }
                }
            },
            function (err, result, ElasticStatus) {
                if(err)
                    res.send("Unable to add Vendor Location" + err );
                else{
                    console.log("Location Stored "+result);
                    res.send(result);
                }


            });

and doing searching like this

 client.search({
                index: 'newtesting',
                type: 'newtesting',
                body: {
                    "query": {
                        "bool" : {
                            "must" : {
                                "match_all" : { }
                            },
                            "filter" : {
                                "geo_distance" : {
                                    "distance" : "150km",
                                    "geoABC" : {
                                        "lat" : "31.479386",
                                        "lon" : "74.341769"
                                    }
                                }
                            }
                        }
                    }
                }
            }).then(function (resp) {
                var hits = resp.hits.hits;
                console.log(hits.length, "items around");
            }).catch(function (error) {
                console.log("Error on geo_distance (coordiates) " + error);
            });

I've tried many different formats, but I always get this same error, tried different versions as well, but same error
"[query_shard_exception] failed to find geo_point field [geoABC]"
Please help me if you have any idea about this

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.