Open sjakhetia opened 7 years ago
Dear @sjakhetia,
Can you show me your code has the problem and the error exception,
Anyway you should use geo_point
elasticsearch datatype not double
Have a look in this page Geo-point datatype.
Thanks for your quick response.
How we can add mapping into elasticsearch. As, I have to update mapping.
Thanks
From: "Basem Khirat" notifications@github.com To: "basemkhirat/elasticsearch" elasticsearch@noreply.github.com Cc: "Me" sjakhetia@flair-solution.com, "Mention" mention@noreply.github.com Sent: Monday, April 17, 2017 4:49:38 PM Subject: Re: [basemkhirat/elasticsearch] error while using distance query (#18)
Dear @sjakhetia ,
Can you show me your code has the problem and the error exception,
Anyway you should use geo_point elasticsearch datatype not double
Have a look in this page Geo-point datatype .
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .
Hi @sjakhetia,
There are two ways to set index mapping:
1) Using query builder:
ES::create("world", function($index){
$index->shards(5)->replicas(1)->mapping([
'countries' => [
'properties' => [
'name' => [
'type' => 'string',
],
'location' => [
'type' => 'geo_point'
]
]
]
])
});
2) [For laravel & Lumen] Using pre-configured index mappings and install them via artisan command:
config/es.php
'indices' => [
'world' => [
'settings' => [
"number_of_shards" => 5,
"number_of_replicas" => 1,
],
'mappings' => [
'countries' => [
'properties' => [
'name' => [
'type' => 'string',
],
'location' => [
'type' => 'geo_point'
]
]
]
]
]
]
Then, run php artisan es:indices:create world
Hope this answer will help you
Thanks for your reply.
I have added a custom mapping for name filed. and it is added successfully. Also, I have created " nGram_analyzer " inside analyzer in settings. "name": { "type": "string", "analyzer": "nGram_analyzer", "search_analyzer": "my_stop_analyzer", "search_quote_analyzer": "my_analyzer" },
Is it working with this query: ES:: type ( "custom_type" ) ->search( $request -> search , function ( $search ) { $search ->boost( 2 )->fields([ "name" => 2 , "description" => 1 , "address.locality" => 1 ]); }) How can I update the existing mapping. Also, Can you please share your skype_id or gmail_id. So, that I will ask you certain things.
Thanks
From: "Basem Khirat" notifications@github.com To: "basemkhirat/elasticsearch" elasticsearch@noreply.github.com Cc: "Me" sjakhetia@flair-solution.com, "Mention" mention@noreply.github.com Sent: Monday, April 17, 2017 9:17:23 PM Subject: Re: [basemkhirat/elasticsearch] error while using distance query (#18)
Hi @sjakhetia ,
There are two ways to set index mapping:
1. Using query builder:
ES :: create( " world " , function ( $index ){ $index -> shards( 5 ) -> replicas( 1 ) -> mapping([ ' countries ' => [ ' properties ' => [ ' name ' => [ ' type ' => ' string ' , ], ' location ' => [ ' type ' => ' geo_point ' ] ] ] ]) });
1. Using pre-configured index mappings and install them via artisan command:
* Add index settings in config/es.php
' indices ' => [ ' world ' => [ ' settings ' => [ " number_of_shards " => 5 , " number_of_replicas " => 1 , ], ' mappings ' => [ ' countries ' => [ ' properties ' => [ ' name ' => [ ' type ' => ' string ' , ], ' location ' => [ ' type ' => ' geo_point ' ] ] ] ] ] ]
* Then, run php artisan es:indices:create world
Hope this answer will help you
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .
I am getting error while using distance query.
My mapping for distance is :
"pin": { "properties": { "location": { "properties": { "lat": { "type": "double" }, "lon": { "type": "double" } } } } } Can you please tell me, what I am doing wrong into it.
Thank you in advance.