フィールド「スキル」のエンティティのマッピングがあります
* @ORM\Column(name="skills", type="array", nullable=true)
* @Groups({"for_profile_project"})
*/
private $skills = [];
弾性構成 (これは私のすべての構成 postebin です)
チーム:
indexes:
profile:
finder: ~
types:
team:
mappings:
id:
type: integer
slug:
type: string
projects:
type: "nested"
properties:
id: ~
title:
type: string
description:
type: string
skills:
expose: true
persistence:
driver: orm
model: Artel\ProfileBundle\Entity\Teams
provider: ~
listener:
immediate: true
finder: ~
そしてDBでは私はこのようにしています
a:5:{i:0;a:2:{s:4:"lang";s:10:"JavaScript";s:7:"percent";d:44.169475214305216;}i:1;a:2:{s:4:"lang";s:3:"CSS";s:7:"percent";d:37.235383527019629;}i:2;a:2:{s:4:"lang";s:3:"PHP";s:7:"percent";d:10.312846145221229;}i:3;a:2:{s:4:"lang";s:4:"HTML";s:7:"percent";d:8.1084777328220206;}i:4;a:2:{s:4:"lang";s:10:"ApacheConf";s:7:"percent";d:0.17381738063190688;}}
エンティティを更新するとエラーが発生します
Merging dynamic updates triggered a conflict: mapper [projects.skills.percent] of different type, current_type [double], merged_type [long]
フィールドスキルに必要なタイプ、またはエラスティック設定を修正する方法は? 私の設定で何が問題になっていますか?
エラスティックおよび実行コマンドですべてのインデックスを削除しました
app/console fos:elastica:populate --no-reset
そして今、私はこのマッピングを持っています
"team": {
"properties": {
"skills": {
"type": "string"
},
"webSite": {
"type": "string"
},
"createdAt": {
"format": "strict_date_optional_time||epoch_millis",
"type": "date"
},
"projects": {
"properties": {
"cost": {
"type": "long"
},
"authorId": {
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"id": {
"type": "long"
},
"username": {
"type": "string"
}
}
},
"skills": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
そして今、私は1つのスキル(a:1:{i:0;s:6:"skills";})でテストプロジェクトを作成しますが、エンティティチームを編集するかコマンドを実行するときにのみエラスティックに自動的にアップロードしません
app/console fos:elastica:populate --no-reset
実際のプロジェクトを追加すると
a:5:{i:0;a:2:{s:4:"lang";s:10:"JavaScript";s:7:"percent";d:44.169475214305216;}i:1;a:2:{s:4:"lang";s:3:"CSS";s:7:"percent";d:37.235383527019629;}i:2;a:2:{s:4:"lang";s:3:"PHP";s:7:"percent";d:10.312846145221229;}i:3;a:2:{s:4:"lang";s:4:"HTML";s:7:"percent";d:8.1084777328220206;}i:4;a:2:{s:4:"lang";s:10:"ApacheConf";s:7:"percent";d:0.17381738063190688;}}
そして走る
app/console fos:elastica:populate --no-reset
または、このエンティティチームのネストされたエンティティ開発者を追加すると、エラーが発生します:
Notice: Array to string conversion
mapper_parsing_exception
failed to parse [projects.skills]
illegal_argument_exception
unknown property [lang]
整数のようにパーセントを設定しようとしましたが、まだエラーがあります
a:5:{i:0;a:2:{s:4:"lang";s:10:"JavaScript";s:7:"percent";d:44;}i:1;a:2:{s:4:"lang";s:3:"CSS";s:7:"percent";d:37;}i:2;a:2:{s:4:"lang";s:3:"PHP";s:7:"percent";d:10;}i:3;a:2:{s:4:"lang";s:4:"HTML";s:7:"percent";d:8;}i:4;a:2:{s:4:"lang";s:10:"ApacheConf";s:7:"percent";d:0;}}
私は試します
skills:
expose: true
properties:
lang:
type: string
percent:
type: double
しかし、まだ持っています
Notice: Array to string conversion
mapper_parsing_exception
failed to parse [projects.skills]
illegal_argument_exception
unknown property [lang]
アップデート
今、私はインデックスを削除し、次のように構成を変更しました:
skills:
properties:
lang:
type: string
percent:
type: double
そして弾性で
"skills": {
"properties": {
"lang": {
"type": "string"
},
"percent": {
"type": "double"
}
}
},
そして、次のようなフィールドスキルを持つエンティティをアップロードすると:
a:5:{i:0;a:2:{s:4:"lang";s:10:"JavaScript";s:7:"percent";d:44.169475214305216;}i:1;a:2:{s:4:"lang";s:3:"CSS";s:7:"percent";d:37.235383527019629;}i:2;a:2:{s:4:"lang";s:3:"PHP";s:7:"percent";d:10.312846145221229;}i:3;a:2:{s:4:"lang";s:4:"HTML";s:7:"percent";d:8.1084777328220206;}i:4;a:2:{s:4:"lang";s:10:"ApacheConf";s:7:"percent";d:0.17381738063190688;}}
すべて問題ありませんが、フィールドでエンティティを作成すると
a:1:{i:0;s:8:"skills23";}
エラーがあります
アップデート
skills:
expose: true
github:
properties:
lang:
type: string
percent:
type: double
フィールド github がエラスティックで作成されない理由がわかりません (これは私のすべての設定postebin です)