ChatGPT is amazing but its answers leave a lot to be desired. I can tell it is automatic pattern recognition because the data fed into it would heavily skew to the longstanding standard Elasticsearch REST API because that has been deeply documented for many years, whereas the patterns would be weakly recognized for the newer Elasticsearch Java API which has less documentation behind it.
I go round and round with ChatGPT pointing out its errors but it doesn't really learn from them. It doesn't recognize the chat itself as a strong basis for learning. Look here, I just told it that a method doesn't exist, and it apologizes, says it doesn't exist, then gives an example using that method.