Digitization of historical documents is growing rapidly. Text retrieval is a vital technology to facilitate the use of historical document images because of the large amount of data. In this paper, we propose a method for retrieving keywords in Japanese historical documents with text query. The proposed method automatically generates an image of the query text and retrieves regions in documents similar to the generated image by feature matching. We exploit a technique of deep learning to generate an image close to texts in Japanese historical document images. Furthermore, we use con-volutional neural network to extract features robust to appearance variation of texts in documents, such as shade and shape of texts. We conducted the text retrieval experiments on the public dataset of Japanese historical documents in the Edo era. The experimental results show the effectiveness of the proposed method.