1. A document management system for managing a plurality of documents, the document management system comprising at least one hardware processor which executes a computer program to function as: a first selection unit configured to select, based on a user's instruction, a first set of libraries from a plurality of libraries as a search target, wherein the plurality of libraries are units of document management, and wherein index definitions are independently defined for each of the plurality of libraries; a second selection unit configured to select, based on a user's instruction, a second set of libraries from a plurality of libraries as an index acquisition target to acquire index names defined for the selected second set of libraries, wherein the second set of libraries differs from the first set of libraries; a search condition setting unit configured to display the index names acquired by the second selection unit, make a user select a desired index name from among the displayed index names, and set a search condition using the selected index name; and a search unit configured to search for a document corresponding to the search condition set by the search condition setting unit from among a plurality of documents managed by the first set of libraries selected as the search target by the first selection unit.