ElasticSearch - Remove English indexing, leave only Bulgarian
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
ElasticSearch - Remove English indexing, leave only Bulgarian
Laravel framework version: 10.16.1
Aimeos Laravel version: 2023.04.*
PHP Version: 8.2.8
Environment: Linux
Hello,
I'd like to remove the ElasticSearch index for english to improve the speed.
These need to be removed from the index:
What are the steps to do it?
Currently I have the english locale disabled, but it's still being indexed.
This is what the mapping currently looks like:
Aimeos Laravel version: 2023.04.*
PHP Version: 8.2.8
Environment: Linux
Hello,
I'd like to remove the ElasticSearch index for english to improve the speed.
These need to be removed from the index:
- text:content(en)
- text:name(en)
- text:url(en)
What are the steps to do it?
Currently I have the english locale disabled, but it's still being indexed.
This is what the mapping currently looks like:
Code: Select all
"mappings" : {
"properties" : {
"attribute" : {
"type" : "object",
"enabled" : false
},
"base" : {
"properties" : {
"orders" : {
"type" : "long"
},
"product" : {
"properties" : {
"boost" : {
"type" : "float"
},
"code" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"config" : {
"type" : "object",
"enabled" : false
},
"ctime" : {
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss"
},
"dataset" : {
"type" : "keyword"
},
"dateend" : {
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss"
},
"datestart" : {
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss"
},
"editor" : {
"type" : "keyword"
},
"id" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"instock" : {
"type" : "integer"
},
"label" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"mtime" : {
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss"
},
"rating" : {
"type" : "float"
},
"ratings" : {
"type" : "integer"
},
"scale" : {
"type" : "float"
},
"siteid" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"status" : {
"type" : "short"
},
"target" : {
"type" : "keyword"
},
"type" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"url" : {
"type" : "keyword",
"eager_global_ordinals" : true
}
}
},
"score" : {
"type" : "float"
},
"seen" : {
"type" : "long"
}
}
},
"catalog" : {
"type" : "object",
"enabled" : false
},
"domains" : {
"type" : "keyword"
},
"index" : {
"properties" : {
"attribute" : {
"type" : "nested",
"properties" : {
"id" : {
"type" : "keyword",
"eager_global_ordinals" : true
}
}
},
"attributeid" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"catalog" : {
"type" : "nested",
"properties" : {
"id" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"listtype" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"position" : {
"type" : "integer"
}
}
},
"catalogid" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"price:value(BGN)" : {
"type" : "float"
},
"siteid" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"supplier" : {
"type" : "nested",
"properties" : {
"id" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"listtype" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"position" : {
"type" : "integer"
}
}
},
"supplierid" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"supplierloc" : {
"type" : "geo_point"
},
"tagid" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"text:content()" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"text:content(bg)" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"text:content(en)" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"text:name()" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"text:name(bg)" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"text:name(en)" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"text:url()" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"text:url(bg)" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"text:url(en)" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
},
"media" : {
"type" : "object",
"enabled" : false
},
"price" : {
"type" : "object",
"enabled" : false
},
"product" : {
"type" : "object",
"enabled" : false
},
"product/property" : {
"type" : "object",
"enabled" : false
},
"product:has" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"product:prop" : {
"type" : "keyword",
"eager_global_ordinals" : true
},
"supplier" : {
"type" : "object",
"enabled" : false
},
"text" : {
"type" : "object",
"enabled" : false
}
}
}
}
Re: ElasticSearch - Remove English indexing, leave only Bulgarian
The \Aimeos\MShop\Product\Manager\Elastic class contains a getLanguageIds() method which you can overwrite and fetch only active languages.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: ElasticSearch - Remove English indexing, leave only Bulgarian
I understand what I need to change.
How do you override this:
Aimeos\MShop\Product\Manager\Elastic
I tried the following, didn't work:
Code: Select all
/**
* Returns the language IDs available for the current site
*
* @return string[] List of ISO language codes
*/
protected function getLanguageIds() : array
{
if( !isset( $this->languageIds ) )
{
$list = [];
$manager = \Aimeos\MShop::create( $this->context(), 'locale' );
$items = $manager->search( $manager->filter()->add( 'locale.status', '==', 1 )->slice( 0, 10000 ) );
foreach( $items as $item ) {
$list[$item->getLanguageId()] = null;
}
$this->languageIds = array_keys( $list );
}
return $this->languageIds;
}
Aimeos\MShop\Product\Manager\Elastic
I tried the following, didn't work:
Code: Select all
'mshop' => [
'product' => [
'manager' => [
'name' => 'ElasticCustom'
]
],
]
Code: Select all
<?php
namespace Aimeos\MShop\Product\Manager;
class ElasticCustom extends Elastic
{
/**
* Returns the language IDs available for the current site
*
* @return string[] List of ISO language codes
*/
protected function getLanguageIds() : array
{
if( !isset( $this->languageIds ) )
{
$list = [];
$manager = \Aimeos\MShop::create( $this->context(), 'locale' );
$items = $manager->search( $manager->filter()->add( 'locale.status', '==', 1 )->slice( 0, 10000 ) );
foreach( $items as $item ) {
$list[$item->getLanguageId()] = null;
}
$this->languageIds = array_keys( $list );
}
return $this->languageIds;
}
}
Re: ElasticSearch - Remove English indexing, leave only Bulgarian
You have to extend the index/text manager instead because it extends from the product manager. Your custom product manager isn't used when indexing.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: ElasticSearch - Remove English indexing, leave only Bulgarian
Thanks, that worked 