Closed apsdehal closed 9 years ago
Tokenizers/analyzers are set on the index settings and that's out of scope for Bouncy. I could add such a functionality, but it would be a direct interface to the low level ElasticSearch client and wouldn't provide much of a value. You can build indexes with indeces()->create() and provide your own settings, including the tokenizer.
Bouncy exposes an Elastic
facade for the low level client. Basically, you'd have something like below. I personally prefer to place such operations in an artisan command, so I have them handy whenever I need to rebuild an index.
$params['index'] = 'my_index';
$params['body']['settings']['analysis'] = [
'analyzer' => [
'myngram' => [
'tokenizer' => 'myngramtokenizer'
]
],
'tokenizer' => [
// ...
]
];
Elastic::indices()->create($params);
As for applying the analyzer to a field, you can do that with Bouncy's mappings. They are set as simple model properties.
Let me know if I missed something.
Thanks a lot. It was really helpful.
Is there a way to add custom analyzers while indexing? Like I want to use nGram tokenizer to analyze.