Have you ever looked at a chiastic outline of Ecclesiastes?
The very center of the book is:
Ecclesiastes 5:1-7
[1] " Guard your steps as you go to the house of God, and approach to listen rather than to offer the sacrifice of fools; for they do not know that they are doing evil. [2] Do not be quick with your mouth or impulsive in thought to bring up a matter in the presence of God. For God is in heaven and you are on the earth; therefore let your words be few. [3] For the dream comes through much effort, and the voice of a fool through many words. [4] When you make a vow to God, do not be late in paying it; for He takes no delight in fools. Pay what you vow! [5] It is better that you not vow, than vow and not pay. [6] Do not let your speech cause you to sin, and do not say in the presence of the messenger of God that it was a mistake. Why should God be angry on account of your voice, and destroy the work of your hands? [7] For in many dreams and in many words there is futility. Rather, fear God."
Which is fascinating because God came to Solomon in a dream and Solomon made an implicit vow that if God gave him wisdom he would use it to rule God's people in righteousness.
And the themes throughout the book are about how Solomon actually used the wisdom God gave him and the lack of justice and righteousness in the world.