The recommendation is to disable swap entirely:
There are three approaches to disabling swapping. The preferred option is to completely disable swap. If this is not an option, whether or not to prefer minimizing swappiness versus memory locking is dependent on your environment.
bootstrap.memory_lock
is a poor substitute for fixing the OS-level configuration to prevent swapping, because it does not prevent swapping of direct (off-heap) memory.