Answer the question
In order to leave comments, you need to log in
ElasticSearch throws an error when adding a new type?
I am creating a web service using ElasticSearch as the main data store.
There is a registration method, when a request arrives at it, it creates a new user, it goes with a bang, but when creating a type for storing records about the user's friends, an error occurs.
user.php:
$client = ClientBuilder::create()->build();
$user = array(
"login" => $login,
"email" => $email,
"avatar_url" => $avatar_url,
"password" => $password,
"email_verify" => false,
"email_verify_id" => $email_verify_id,
"user_token" => $user_token,
"g-balance" => 0,
"register_time" => time(),
"last_query_time" => time(),
"receive_bonuses" => 0,
"total_playtime" => 0,
"games" => array(
$game_name => array(
"playtime" => 0,
"level" => 0,
"save" => "",
),
),
);
$params = array(
"index" => "socket-apps-db",
"type" => "users",
"id" => mb_strtolower($login),
"body" => $user
);
$database_response = $client->index($params);
if($database_response["result"] == "created"){
return array(
"status" => true,
);
}else{
return array(
"status" => false,
);
}
$client = ClientBuilder::create()->build();
$params = array(
"index" => "socket-apps-friends",
"type" => mb_strtolower($login),
"body" => array(),
);
$client->index($params);
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [socket-apps-friends] as the final mapping would have more than 1 type: [socketsystem, hoo]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [socket-apps-friends] as the final mapping would have more than 1 type: [socketsystem, hoo]"},"status":400}
Answer the question
In order to leave comments, you need to log in
Elastic writes to you that there can be only one type per index!
Here it is
Replace with
And hide the user in the field in the bodysuit.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question