Add your file to the Nix store like so:
nix-store --add-fixed sha256 elasticsearch...tar.gz
Build your derivation normally and the file will be used.
A fetchurl
derivation is a fixed-output derivation and Nix is happy to take any file or directory with the correct hash as a substitute for actually building the derivation. It is mentioned in the documentation that
This can be used for sources that are not available from a public url or broke since the download expression was written.
Which isn’t exactly what you’re looking for, but is close enough.