I am trying to do a GeoQuery with Nest but it dosen't work both on kibana and NEST with .net.
Here is the NEST Query
GeoDistanceQuery a = new GeoDistanceQuery
{
Boost = 1.1,
Name = "named_query",
Field = new Field("location"),
DistanceType = GeoDistanceType.Arc,
Location = new Nest.GeoLocation(0, 0),
Distance = "2000m",
ValidationMethod = GeoValidationMethod.IgnoreMalformed
};
mustClauses.Add(a);
var searchRequest = new SearchRequest<User>("people")
{
Size = 10,
From = 0,
Query = new BoolQuery
{
Should = mustClauses
}
};
And here is the objects what i am triying to find, location (*) is the important field:
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
{
"_index" : "people",
"_type" : "user",
"_id" : "6574f01b-f9ac-4cbb-bce8-7f072eded1ff",
"_score" : 1.0,
"_source" : {
"userDates" : {
"id" : null,
"address1" : null,
"address2" : null,
"city" : null,
"country" : null,
"name" : null,
"postalCode" : null,
"state" : null,
"surname" : null,
"phone" : null,
"score" : 0.0,
**"location" : {**
** "lat" : 0.0,**
** "lon" : 0.0**
** },**
"lat" : 0.0,
"lon" : 0.0,
"profileImg" : null,
"suscribed" : true,
"personalInfo" : null,
"user" : null
},
"admin" : false,
"status" : false,
"rememberMe" : false,
"password" : null,
"token" : null,
"tokenExpiration" : "0001-01-01T00:00:00",
"email" : "javote95@gmail.com",
"userKnowledges" : [
{
"knowledgesId" : "b4e66abc-7dfd-40af-89f9-58af57311be7",
"knowledges" : {
"id" : "b4e66abc-7dfd-40af-89f9-58af57311be7",
"value" : "Arquitectura",
"explanation" : "3973",
"userKnowledges" : [ ],
"jobKnowledges" : null
},
"userId" : "6574f01b-f9ac-4cbb-bce8-7f072eded1ff"
},
{
"knowledgesId" : "f989d840-734c-47c2-b9cf-57f68a0b5c1e",
"knowledges" : {
"id" : "f989d840-734c-47c2-b9cf-57f68a0b5c1e",
"value" : "Arquímedes",
"explanation" : "2752",
"userKnowledges" : [ ],
"jobKnowledges" : null
},
"userId" : "6574f01b-f9ac-4cbb-bce8-7f072eded1ff"
}
],
"jobsWorker" : [ ],
"jobPreWorker" : [ ],
"jobsCreator" : [ ],
"suscription" : null,
"notifications" : [ ],
"id" : "6574f01b-f9ac-4cbb-bce8-7f072eded1ff",
"userName" : "javote95@gmail.com",
"normalizedUserName" : "JAVOTE95@GMAIL.COM",
"normalizedEmail" : "JAVOTE95@GMAIL.COM",
"emailConfirmed" : false,
"passwordHash" : "AQAAAAEAACcQAAAAEFm8eSLL3zsy5ZfiEUxqOlemiXH1+FvM0ytR6RCD/fd3gNNactWRKJRgnfgUfjwRMQ==",
"securityStamp" : "X2I22W2IFYXT4Y6Q4WTTY3CQFONWSWZD",
"concurrencyStamp" : "525ea3e1-f190-435b-ab4e-1ee7e30154cb",
"phoneNumber" : null,
"phoneNumberConfirmed" : false,
"twoFactorEnabled" : false,
"lockoutEnd" : null,
"lockoutEnabled" : true,
"accessFailedCount" : 0
}
}
]
}
}
And here is the query on Kibana:
POST /people/_search?typed_keys=true
{"from":0,"query":{"bool":{"should":[{"geo_distance":{"_name":"named_query","boost":1.1,"validation_method":"ignore_malformed","distance":"20000m","distance_type":"arc","location":{"lat":0.0,"lon":0.0}}}]}},"size":10}
Result:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
I would really appreciate a hand. I am a bit desperate. Thx u guys, regards from Spain slight_smile: