The main objective of the project is to analyze gut, peritoneal and uterine microbiome in women who undergo laparoscopy due to endometriosis (arm 1) or idiopathic infertility (arm 2). Detailed objectives are: i) analysis of the correlation between the composition of the intestinal, peritoneal and uterine microbiome with the stage of endometriosis according to ASRM, ii) qualitative comparison of the intestinal and peritoneal microbiome to the uterine cavity microbiome in women with endometriosis vs. idiopathic infertility, iii) analysis of the correlation between the composition of the intestinal, peritoneal and uterine microbiome with the intensity of pain and infertility, iv) comparing the quality of life in both arms and assessing its correlation with the local microbiome. Quality of life will be assessed in both arms using the SF-36 questionnaire, and then compared. The SF-36 self-reported questionnaire covers eight health domains: physical functioning (10 items), bodily pain (2 items), role limitations due to physical health problems (4 items), role limitations due to personal or emotional problems (4 items), emotional well-being (5 items), social functioning (2 items), energy/fatigue (4 items), and general health perceptions (5 items). Scores for each domain range from 0 to 100, with a higher score defining a more favorable health state. The study group will consist of women of childbearing age, undergoing surgical treatment due to pelvic endometriosis or idiopathic infertility. Before the surgery, a stool sample will be taken for examination of intestinal microbiome. During scheduled laparoscopy, in addition to the planned procedure, which is the purpose of hospitalization, an endometrial aspiration biopsy will be performed and fluid from the peritoneal cavity and/or fluid from the ovarian cyst will be collected for analysis of the local microbiome. Biological materials (stool, peritoneal/ovarian cyst fluid, endometrial aspirate) will be secured and then subjected to molecular analysis using the Next Generation Sequencing (NGS) method. The stages will include: i) isolation of bacterial DNA from biological materials, ii) preparation of libraries for sequencing, including the performance of the PCR and nested-PCR methods on bacterial DNA isolates from the tested samples of biological materials, iii) purification of amplification products, indexing, validation of the concentration of amplicons, pooling and denaturation of libraries, iv) standardization and optimization of the procedure for the isolation of bacterial metagenomic DNA from biological materials from intestines, peritoneal cavity, uterine cavity and endometrial tissues, v) standardization of the nested-PCR method on bacterial DNA isolates from the tested biological materials, vi) submission of samples for sequencing. Sequencing data will be subjected to bioinformatics analysis to obtain bacterial profiles (the percentage composition of the local bacterial population by phyla and genera). The aim is to characterize the microbiome of the intestines, peritoneal and the uterine cavity in women undergoing surgical treatment for endometriosis or invasive diagnostics for idiopathic infertility, and to compare the bacterial populations in these locations, which may also provide information on the origin of bacteria in the peritoneal cavity.