codemix / codemix/YiiElasticSearch

Add mapping feature to models

Open
#18 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
PHP
Stars
33
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Alternatively to the mapping file, we could keep the mapping definition inside the model.

I'd suggest a syntax like this:

``` [php]
public function elasticMapping()
{
return array(
'id' => array('type' => 'integer'),
'name' => array('type' => 'string', 'index'=>'not_analyzed'),
...
);
}
```

Then `./yiic elastic map --model=` would use the data above to find the right mapping.

Not sure, if we should also automate this for the regular auto-indexing on `save()`. This would require a check on every save operation, whether the mapping exists. Probably a bit too extreme.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.