-
Notifications
You must be signed in to change notification settings - Fork 241
Conversation
Indices created in Elasticsearch 6.0.0 or later may only contain a single mapping type. Elastic.co now recommend using one index per document type (https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html#_index_per_document_type). It's the best solution due to his scalability. However, it is no longer possible to search between several types.
src/ElasticsearchEngine.php
Outdated
'index' => $this->index, | ||
'type' => $builder->index ?: $builder->model->searchableAs(), | ||
'index' => $this->indexPrefix.$builder->model->searchableAs(), | ||
'_type' => $this->type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we confirm that this param should indeed be _type
instead of type
?
@@ -24,16 +24,19 @@ class ElasticsearchEngine extends Engine | |||
*/ | |||
protected $elastic; | |||
|
|||
protected $type = 'doc'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future compatibility, consider defaulting $type
to _doc
instead of doc
. See notes under Elasticsearch 7.x in the roadmap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document mapping type name can't start with '_'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, interesting. My bad, it must be reserved for internal use. Thanks for giving it a shot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like that might be a bug that's fixed in 6.2: elastic/elasticsearch#27816
Found it in this discussion:
https://discuss.elastic.co/t/cant-use-doc-as-type-despite-it-being-declared-the-preferred-method/113837
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Elastic.co suggests some alternatives. I've decided to use one index per document type due to his scalability.
However, it breaks the compatibility of the current architecture and requires a major version release.