Refer to the Esri sample https://developers.arcgis.com/javascript/latest/sample-code/identify/live/. which is based on import * as identify from "@arcgis/core/rest/identify";
In the above sample, change the line number 70.
From:
params.layerIds = [0, 1, 2, 3, 4];
To:
params.layerIds = [0];
Actually, layer id 0 represents Roads layer. After the above code change, Identify should work only on Road layer, but it's not the case here.
Additional observation is, for payload of the network transaction, could not see the provided layer ids at all. Refer to the below screenshot.
