ElasticSearch Research & Evidence-Based Practice 2 — Questions and Answers
Question 1: A researcher needs to find documents where the abstract field contains the phrase 'machine learning' within 3 words of 'classification'. Which query type is most appropriate?
- match_phrase query
- span_near query (Correct answer)
- multi_match query
- fuzzy query
Correct answer: span_near query
span_near query lets you specify a maximum distance (slop) between terms, making it ideal for proximity searches within a field.
Question 2: When building a systematic literature review pipeline with Elasticsearch, which aggregation type best identifies the most frequently cited journals in a result set?
- date_histogram aggregation
- terms aggregation (Correct answer)
- range aggregation
- percentiles aggregation
Correct answer: terms aggregation
terms aggregation groups documents by a field value and counts occurrences, making it perfect for identifying top journals by frequency.
Question 3: A research team stores study metadata with a 'publication_date' field. They want to track the volume of publications per month over the past 5 years. Which aggregation should they use?
- auto_date_histogram
- date_range aggregation
- date_histogram with calendar_interval: month (Correct answer)
- terms aggregation on year
Correct answer: date_histogram with calendar_interval: month
date_histogram with calendar_interval: month creates fixed monthly buckets, which is ideal for tracking publication volume over time.
Question 4: A data scientist wants to score research papers higher when they match multiple evidence keywords rather than just one. Which Elasticsearch feature enables boosting relevance based on matching multiple optional terms?
- must clause in bool query
- should clause in bool query (Correct answer)
- filter clause in bool query
- must_not clause in bool query
Correct answer: should clause in bool query
The should clause in a bool query increases the relevance score for each additional matching condition without making any single condition mandatory.
Question 5: A research index stores clinical trial data. Analysts need to retrieve studies with sample sizes between 100 and 500 participants. Which query is best suited?
- match query on sample_size
- range query on sample_size (Correct answer)
- term query on sample_size
- wildcard query on sample_size
Correct answer: range query on sample_size
The range query is designed for numeric field comparisons using gte, lte, gt, and lt operators, making it ideal for filtering sample sizes.
Question 6: Researchers need to deduplicate a dataset of academic papers by DOI before ingesting into Elasticsearch. Which approach best prevents duplicate documents?
- Use auto-generated document IDs
- Use the DOI as the document _id during indexing (Correct answer)
- Add a unique index constraint in the mapping
- Use the dedup pipeline processor
Correct answer: Use the DOI as the document _id during indexing
Setting the DOI as the document _id causes Elasticsearch to overwrite existing documents with the same ID, naturally preventing duplicates.
Question 7: A research analyst wants to retrieve only the 'title', 'authors', and 'year' fields from a large document index to reduce network overhead. Which feature should they use?
- _source filtering with includes (Correct answer)
- stored fields retrieval
- field collapsing
- doc_values access
Correct answer: _source filtering with includes
Source filtering with the _source includes parameter limits the returned fields to only those specified, reducing payload size.
A researcher needs to find documents where the abstract field contains the phrase 'machine learning' within 3 words of 'classification'.
Which query type is most appropriate?