Created
October 16, 2019 22:27
-
-
Save bayareawebpro/ab53ccd81a4855b5267aead158c21670 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use ScoutElastic\IndexConfigurator; | |
use ScoutElastic\Migratable; | |
class LocationIndex extends IndexConfigurator | |
{ | |
use Migratable; | |
protected $name = "locations"; | |
/** | |
* Configure Analyzers | |
* https://github.com/babenkoivan/scout-elasticsearch-driver | |
* https://www.elastic.co/guide/en/elasticsearch/guide/current/configuring-analyzers.html | |
* https://www.elastic.co/guide/en/elasticsearch/guide/current/asciifolding-token-filter.html | |
* https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-edgengram-tokenizer.html | |
* https://www.elastic.co/guide/en/elasticsearch/reference/6.7/search-aggregations-bucket-geohashgrid-aggregation.html | |
* https://hackernoon.com/elasticsearch-building-autocomplete-functionality-494fcf81a7cf | |
* @var array | |
*/ | |
protected $settings = [ | |
"analysis" => [ | |
"analyzer" => [ | |
"keyword" => [ | |
"type"=> "custom", | |
"tokenizer"=> "keyword", | |
"filter"=> [ | |
"lowercase", | |
"asciifolding" | |
], | |
], | |
"autocomplete" => [ | |
"tokenizer" => "edge_ngram", | |
"filter" =>[ | |
"lowercase", | |
"asciifolding" | |
], | |
], | |
"autocomplete_search" => [ | |
"tokenizer" => "lowercase", | |
"filter"=> [ | |
"lowercase", | |
"asciifolding" | |
], | |
] | |
], | |
"tokenizer" => [ | |
"edge_ngram"=> [ | |
"type"=> "edge_ngram", | |
"min_gram"=> 2, | |
"max_gram"=> 10, | |
"token_chars" => [ | |
"letter", | |
"digit" | |
] | |
], | |
], | |
"aggregations" => [ | |
"large-grid" => [ | |
"geohash_grid" => [ | |
"field" => "geo_point", | |
"precision" => 3, | |
] | |
] | |
], | |
] | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment