# エラー Too many operations declared on operation entry

**URL:** <https://discuss.elastic.co/t/too-many-operations-declared-on-operation-entry/201892>\
**Category:** 日本語による質問・議論はこちら\
**Created:** [October 2, 2019, 4:09am UTC](https://discuss.elastic.co/t/too-many-operations-declared-on-operation-entry/201892 "2019-10-02T04:09:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Masanori\_Mishima](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masanori_mishima/32/45030_2.png) [@Masanori\_Mishima](https://discuss.elastic.co/u/Masanori_Mishima)\
**Post date:** [October 2, 2019, 4:09am UTC](https://discuss.elastic.co/t/too-many-operations-declared-on-operation-entry/201892/1 "2019-10-02T04:09:32Z")

</div>

node.jsから非同期処理を用いて  
1.旧indexのindex\_name取得  
2.旧indexのaliasをremove、新indexに旧につけていたalias名と同じものをaliasとしてadd  
3.旧indexの削除

を行ったところタイトルのerrorが出ました。原因は一度に大量のオペレーションを宣言したからということみたいですが、解決策は何がありますでしょうか？

> { StatusCodeError: 400 - {"error":{"root\_cause":[{"type":"x\_content\_parse\_exception","reason":"Failed to build [alias\_action] after last required field arrived"}],"type":"x\_content\_parse\_exception","reason":"[1:180] [aliases] failed to parse field [actions]","caused\_by":{"type":"x\_content\_parse\_exception","reason":"Failed to build [alias\_action] after last required field arrived","caused\_by":{"type":"illegal\_argument\_exception","reason":"Too many operations declared on operation entry"}}},"status":400}

---

<div class="post-metadata">

**Author:** ![tsgkdt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsgkdt/32/39151_2.png) [@tsgkdt](https://discuss.elastic.co/u/tsgkdt)\
**Post date:** [October 2, 2019, 6:30am UTC](https://discuss.elastic.co/t/too-many-operations-declared-on-operation-entry/201892/2 "2019-10-02T06:30:49Z")

</div>

ソースを見ますと、大量でなくても１つ以上あればToo many operationsというエラーが出るみたいですね。

> Take the first action and complain if there are more than one actions

> <https://github.com/elastic/elasticsearch/blob/f94b3df6a54f6c00b099a48ec06b82d2bd2589dd/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java#L213>

さて、「非同期処理を用いて」とありますが、１つずつ処理を **同期処理** で実行した場合にもこのようなエラーになりますでしょうか？

あるいは、この現象が必ず起きるのか、たまたま起きるのか、そのあたりの情報はありますか？  
再現手順などがあればそれを書いてもらえると助かります。

---

<div class="post-metadata">

**Author:** ![Masanori\_Mishima](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masanori_mishima/32/45030_2.png) [@Masanori\_Mishima](https://discuss.elastic.co/u/Masanori_Mishima)\
**Post date:** [October 15, 2019, 11:09am UTC](https://discuss.elastic.co/t/too-many-operations-declared-on-operation-entry/201892/3 "2019-10-15T11:09:21Z")

</div>

回答ありがとうございます。  
node.jsのrequestメソッドでjsonを送る時に  
jsonの記述にミスがあったことが原因でした。

> json: {  
> actions: [  
> { add: { index: newIndexName, alias: alias }  
> remove: { index: oldIndexName, alias: alias } },  
> ],  
> },

↑のような形で送ると再現するかと思います。

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 12, 2019, 11:10am UTC](https://discuss.elastic.co/t/too-many-operations-declared-on-operation-entry/201892/4 "2019-11-12T11:10:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
