Elasticquent
Elasticquent copied to clipboard
mapper_parsing_exception
I am using ES through docker using below 2 commands..
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.1.1
docker run -d --rm --name search-aol -p 9200:9200 -p 9300:9300 -e discovery.type=single-node -e http.cors.enabled=true -e http.cors.allow-origin=http://localhost:1358,http://127.0.0.1:1358 -e http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization -e http.cors.allow-credentials=true -d docker.elastic.co/elasticsearch/elasticsearch:7.1.1
Just followed this tutorial -> Click Here
My Model is
class Article extends Model
{
use ElasticquentTrait;
protected $fillable = ['title', 'body', 'tags'];
protected $mappingProperties = array(
'title' => [
'type' => 'text',
"analyzer" => "standard",
],
'body' => [
'type' => 'text',
"analyzer" => "standard",
],
'tags' => [
'type' => 'text',
"analyzer" => "standard",
],
);
function getTypeName()
{
return 'article_type_name';
}
}
When trying create index gives an exception
use App\Article;
Route::get('/test', function () {
Article::createIndex($shards = null, $replicas = null);
Article::putMapping($ignoreConflicts = true);
Article::addAllToIndex();
return view('welcome');
});
elasticquent.php
<?php
return array(
'config' => [
'hosts' => ['localhost:9200'],
'retries' => 1,
],
'default_index' => 'laravel_test',
);
My Packages
"php": "^7.1.3", "elasticquent/elasticquent": "dev-master", "elasticsearch/elasticsearch": "6.1.0",
Below is the error being throw when creating index
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [article_type_name : {_source={enabled=true}, properties={title={analyzer=standard, type=text}, body={analyzer=standard, type=text}, tags={analyzer=standard, type=text}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [article_type_name : {_source={enabled=true}, properties={title={analyzer=standard, type=text}, body={analyzer=standard, type=text}, tags={analyzer=standard, type=text}}}]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [article_type_name : {_source={enabled=true}, properties={title={analyzer=standard, type=text}, body={analyzer=standard, type=text}, tags={analyzer=standard, type=text}}}]"
}
},
"status": 400
}
I have the same error and I don't know what else to do
See #169. I haven't used 7.x yet, but setting getTypeName() to return "_doc" or "" should work.
function getTypeName()
{
return '_doc';
}
I am facing exact same issue. Did anyone found a solution to this?
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [elastic_questions : {_source={enabled=true}, properties={product_isbn={analyzer=standard, type=keyword}, customer_question={analyzer=standard, type=text}, product_upc={analyzer=standard, type=keyword}, product_mpn={analyzer=standard, type=keyword}, original_product_id={analyzer=standard, type=integer}, product_ean={analyzer=standard, type=keyword}}}]"}]
See #169. I haven't used 7.x yet, but setting getTypeName() to return "_doc" or "" should work.
function getTypeName() { return '_doc'; }
i met
"{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."}],"type":"illegal_argument_exception","reason":"The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."},"status":400}"
when change getTypeName to _doc, how can i set include_type_name to elastic request.
I am facing the same issue but still I didn't get answer please explain it in a detail way and explain where we need to change
Hi guys, I have met this issues on ES 7.6.2 are there any solutions?
I have the same issue, my fix was delete setType($type);
in the file vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php
at line 287
, take care if you run composer update your change will be lost.
Hello,
Is there a solution to this problem?