Be careful using chat GPT for elasticsearch instructions as the data is several years old and we've had significant changes since then.
Also, what's worse sometimes as you just discovered the results can seem very correct and convincing and yet be incorrect.