Image SearchのインポートでV2用のデータは作れるか？

# 結論
v2で新たに追加された項目（IntAttr、StrAttr）の登録は~~できませんでした~~。***できる***ようです。V2用のフォーマットでデータを投入するには、APIを使って登録を行う必要がありそうです。
API経由での登録は、最大クエリ/秒（QPS）に依存するので、無料版の場合は「1 クエリ/秒」となります。

## データの削除

``` increment.meta
{"operator":"DELETE","item_id":"1000"}
{"operator":"DELETE","item_id":"1001"}
{"operator":"DELETE","item_id":"1002"}
{"operator":"DELETE","item_id":"1003"}
{"operator":"DELETE","item_id":"1004"}
{"operator":"DELETE","item_id":"1005"}
{"operator":"DELETE","item_id":"1006"}
{"operator":"DELETE","item_id":"1007"}
{"operator":"DELETE","item_id":"1008"}
{"operator":"DELETE","item_id":"1009"}
{"operator":"DELETE","item_id":"1010"}
{"operator":"DELETE","item_id":"1011"}
```
![2020-05-20 (3).png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18582/2066a4c2-df7c-0387-006f-ffccffd69b4a.png)
![01.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18582/9e73d0cb-a768-32be-185c-a3ac726b83a6.png)
![2020-05-20 (9).png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18582/b483545c-7bee-939e-2c61-c1e354e1e559.png)

## データフォーマットは以下の通りです（UPDATE 2020.05.26）
```
{"operator":"ADD","item_id":"1000", "cat_id":0, "int_attr":0, "str_attr":"value1", "cust_content":"k1:v1,k2:v2,k3:v3", "pic_list":["girl_cloth1.jpg"]}
```
int_attr、str_attr にすれば行けそうですね。（2020.05.26 UPDATE）

## データパターン　その１
パラメータ名をV2用に書き換えて実行する

``` increment.meta
{"operator":"ADD","ProductId":"1000", "CategoryId":9, "CustomContent":"k1:v01,k2:v200,k3:v300","IntAttr":1000,"StrAttr":"絶版商品", "pic_list":["01.jpg"]}
{"operator":"ADD","ProductId":"1001", "CategoryId":9, "CustomContent":"k1:v02,k2:v201,k3:v301","IntAttr":2000,"StrAttr":"新作商品", "pic_list":["02.jpg"]}
{"operator":"ADD","ProductId":"1002", "CategoryId":9, "CustomContent":"k1:v03,k2:v202,k3:v302","IntAttr":3000,"StrAttr":"絶版商品", "pic_list":["03.jpg"]}
{"operator":"ADD","ProductId":"1003", "CategoryId":9, "CustomContent":"k1:v04,k2:v203,k3:v303","IntAttr":5000,"StrAttr":"新作商品", "pic_list":["04.jpg"]}
{"operator":"ADD","ProductId":"1004", "CategoryId":9, "CustomContent":"k1:v05,k2:v204,k3:v304","IntAttr":7777,"StrAttr":"絶版商品", "pic_list":["05.jpg"]}
{"operator":"ADD","ProductId":"1005", "CategoryId":9, "CustomContent":"k1:v06,k2:v205,k3:v305","IntAttr":10000,"StrAttr":"新作商品", "pic_list":["06.jpg"]}
{"operator":"ADD","ProductId":"1006", "CategoryId":9, "CustomContent":"k1:v07,k2:v206,k3:v306","IntAttr":5000,"StrAttr":"絶版商品,新作商品", "pic_list":["07.jpg"]}
{"operator":"ADD","ProductId":"1007", "CategoryId":9, "CustomContent":"k1:v08,k2:v207,k3:v307","IntAttr":1000,"StrAttr":"中古商品", "pic_list":["08.jpg"]}
{"operator":"ADD","ProductId":"1008", "CategoryId":9, "CustomContent":"k1:v09,k2:v208,k3:v308","IntAttr":100,"StrAttr":"イベント商品", "pic_list":["09.jpg"]}
{"operator":"ADD","ProductId":"1009", "CategoryId":9, "CustomContent":"k1:v10,k2:v209,k3:v309","IntAttr":1100,"StrAttr":"絶版商品,イベント商品", "pic_list":["10.jpg"]}
{"operator":"ADD","ProductId":"1010", "CategoryId":9, "CustomContent":"k1:v11,k2:v210,k3:v310","IntAttr":9999,"StrAttr":"絶版商品,絶版商品,新作商品,イベント商品", "pic_list":["11.jpg"]}

```
![2020-05-20 (15).png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18582/777ee3ea-b622-234b-8093-1fb449cb9966.png)

``` report
{"operator":"ADD","ProductId":"1000", "CategoryId":9, "CustomContent":"k1:v01,k2:v200,k3:v300","IntAttr":1000,"StrAttr":"絶版商品", "pic_list":["01.jpg"]}	no item_id
{"operator":"ADD","ProductId":"1001", "CategoryId":9, "CustomContent":"k1:v02,k2:v201,k3:v301","IntAttr":2000,"StrAttr":"新作商品", "pic_list":["02.jpg"]}	no item_id
{"operator":"ADD","ProductId":"1002", "CategoryId":9, "CustomContent":"k1:v03,k2:v202,k3:v302","IntAttr":3000,"StrAttr":"絶版商品", "pic_list":["03.jpg"]}	no item_id
{"operator":"ADD","ProductId":"1003", "CategoryId":9, "CustomContent":"k1:v04,k2:v203,k3:v303","IntAttr":5000,"StrAttr":"新作商品", "pic_list":["04.jpg"]}	no item_id
{"operator":"ADD","ProductId":"1004", "CategoryId":9, "CustomContent":"k1:v05,k2:v204,k3:v304","IntAttr":7777,"StrAttr":"絶版商品", "pic_list":["05.jpg"]}	no item_id
{"operator":"ADD","ProductId":"1005", "CategoryId":9, "CustomContent":"k1:v06,k2:v205,k3:v305","IntAttr":10000,"StrAttr":"新作商品", "pic_list":["06.jpg"]}	no item_id
{"operator":"ADD","ProductId":"1006", "CategoryId":9, "CustomContent":"k1:v07,k2:v206,k3:v306","IntAttr":5000,"StrAttr":"絶版商品,新作商品", "pic_list":["07.jpg"]}	no item_id
{"operator":"ADD","ProductId":"1007", "CategoryId":9, "CustomContent":"k1:v08,k2:v207,k3:v307","IntAttr":1000,"StrAttr":"中古商品", "pic_list":["08.jpg"]}	no item_id
{"operator":"ADD","ProductId":"1008", "CategoryId":9, "CustomContent":"k1:v09,k2:v208,k3:v308","IntAttr":100,"StrAttr":"イベント商品", "pic_list":["09.jpg"]}	no item_id
{"operator":"ADD","ProductId":"1009", "CategoryId":9, "CustomContent":"k1:v10,k2:v209,k3:v309","IntAttr":1100,"StrAttr":"絶版商品,イベント商品", "pic_list":["10.jpg"]}	no item_id
{"operator":"ADD","ProductId":"1010", "CategoryId":9, "CustomContent":"k1:v11,k2:v210,k3:v310","IntAttr":9999,"StrAttr":"絶版商品,絶版商品,新作商品,イベント商品", "pic_list":["11.jpg"]}	no item_id

```

no item_id とのことです。

## データパターン　その２
V2で追加された2つの属性を追加して実行してみます。

``` increment.meta
{"operator":"ADD","item_id":"1000", "cat_id":9, "cust_content":"k1:v01,k2:v200,k3:v300","IntAttr":1000,"StrAttr":"絶版商品", "pic_list":["01.jpg"]}
{"operator":"ADD","item_id":"1001", "cat_id":9, "cust_content":"k1:v02,k2:v201,k3:v301","IntAttr":2000,"StrAttr":"新作商品", "pic_list":["02.jpg"]}
{"operator":"ADD","item_id":"1002", "cat_id":9, "cust_content":"k1:v03,k2:v202,k3:v302","IntAttr":3000,"StrAttr":"絶版商品", "pic_list":["03.jpg"]}
{"operator":"ADD","item_id":"1003", "cat_id":9, "cust_content":"k1:v04,k2:v203,k3:v303","IntAttr":5000,"StrAttr":"新作商品", "pic_list":["04.jpg"]}
{"operator":"ADD","item_id":"1004", "cat_id":9, "cust_content":"k1:v05,k2:v204,k3:v304","IntAttr":7777,"StrAttr":"絶版商品", "pic_list":["05.jpg"]}
{"operator":"ADD","item_id":"1005", "cat_id":9, "cust_content":"k1:v06,k2:v205,k3:v305","IntAttr":10000,"StrAttr":"新作商品", "pic_list":["06.jpg"]}
{"operator":"ADD","item_id":"1006", "cat_id":9, "cust_content":"k1:v07,k2:v206,k3:v306","IntAttr":5000,"StrAttr":"絶版商品,新作商品", "pic_list":["07.jpg"]}
{"operator":"ADD","item_id":"1007", "cat_id":9, "cust_content":"k1:v08,k2:v207,k3:v307","IntAttr":1000,"StrAttr":"中古商品", "pic_list":["08.jpg"]}
{"operator":"ADD","item_id":"1008", "cat_id":9, "cust_content":"k1:v09,k2:v208,k3:v308","IntAttr":100,"StrAttr":"イベント商品", "pic_list":["09.jpg"]}
{"operator":"ADD","item_id":"1009", "cat_id":9, "cust_content":"k1:v10,k2:v209,k3:v309","IntAttr":1100,"StrAttr":"絶版商品,イベント商品", "pic_list":["10.jpg"]}
{"operator":"ADD","item_id":"1010", "cat_id":9, "cust_content":"k1:v11,k2:v210,k3:v310","IntAttr":9999,"StrAttr":"絶版商品,絶版商品,新作商品,イベント商品", "pic_list":["11.jpg"]}

```

エラーは無いようです。
ただ、属性は追加されていないようです。

![2020-05-21.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18582/c2b74143-1e2f-ccf4-e6a0-82906a44de96.png)

しかもよく見ると、属性はV1のまま。。。

## まとめ

Image SearchのインポートはV2には~~対応していない~~ **対応している**ようです。インポートはAPIの呼び出し回数に依存しないで高速に画像を登録する事ができるので、ぜひ~~対応してほしいものです~~。**(対応しているようです＞＜ 2020.05.26）**
追加で要望をあげるとしたら、インポートのAPIも公開してほしいです。現状は、管理画面からしか実行する事ができないので手動で実行する必要がありますが、プログラムから実行できるようになると嬉しいです。