Possessing a strong piezoresistivity, nanocomposites of metal nanowires and elastomer have been studied extensively for its use in highly flexible, stretchable, and sensitive sensors. In this work, we analyze the working mechanism and performance of a nanocomposite based stretchable strain sensor by calculating the conductivity of the nanowire percolation network as a function of strain. We reveal that the nonlinear piezoresistivity is attributed to the topological change of percolation network, which leads to a bottleneck in the electric path. We find that, due to enhanced percolation, the linearity of the sensor improves with increasing aspect ratio or volume fraction of the nanowires at the expense of decreasing gauge factor. In addition, we show that a wide range of gauge factors (from negative to positive) can be obtained by changing the orientation distribution of nanowires. Our study suggests a way to intelligently design nanocomposite-based piezoresistive sensors for flexible and wearable devices.