<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/mongodb-search-server-improved--yrvwi4uh6" -->

---
title: MongoDB Search Server, improved! | daily.dev
description: An open-source Java-based search server built on MongoDB Search gets a round of new features: faceting (string, numeric, and date), sorting, highlighting,...
canonical: https://daily.dev/posts/mongodb-search-server-improved--yrvwi4uh6
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: MongoDB Search Server, improved! | daily.dev
og:description: An open-source Java-based search server built on MongoDB Search gets a round of new features: faceting (string, numeric, and date), sorting, highlighting,...
og:url: https://daily.dev/posts/mongodb-search-server-improved--yrvwi4uh6
og:image: https://api.daily.dev/og/posts/YRVWI4uh6.png
og:image:alt: MongoDB Search Server, improved!
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# MongoDB Search Server, improved!

**[Foojay.io](https://daily.dev/sources/foojayio)** · 14 min read · 0 upvotes · 0 comments

## Summary

An open-source Java-based search server built on MongoDB Search gets a round of new features: faceting (string, numeric, and date), sorting, highlighting, weighted search fields, and negative/exclusion filters. The piece walks through the query parameters, shows sample requests and generated aggregation pipeline JSON, and discusses why the project moved away from MongoDB's search-specific Java driver conveniences in favor of raw BSON construction for flexibility. It also covers running the server locally via Gradle or deploying it with Docker.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://foojay.io/today/mongodb-search-server-improved>

## Questions this post answers

### How do I add negative or exclusion filters to a MongoDB Search query in Java?

Prefix the filter parameter's field name with a minus sign, such as filter=-genres:Drama, to exclude documents matching that value. Internally this translates to a compound.mustNot.equals clause in the MongoDB Search aggregation pipeline, instead of the compound.filter.equals clause used for normal inclusion filters.

_Developers wiring up MongoDB search filters can track patterns like this via daily.dev._

### How do I boost the relevance weight of a specific field in a MongoDB Search query from Java?

Use the field^weight syntax on any search field, for example title^2 to give matches in the title field twice the relevance weight of matches elsewhere. This score boost is applied via a compound.should text clause with a boost.value in the generated aggregation pipeline, and even a small weight increase can noticeably improve result ordering.

_Anyone tuning MongoDB search relevance can compare weighting approaches through daily.dev._

### How does faceting work when the limit parameter is set to 0 in a MongoDB Search aggregation pipeline?

Setting limit=0 switches the pipeline internally from the $search stage to $searchMeta, since no documents need to be returned, only facet counts across the entire collection. The response format stays the same regardless of the limit value, so callers don't need to handle a different shape.

_Developers building faceted search endpoints can dig into pipeline internals like this on daily.dev._

## Similar posts on daily.dev

- [Exploring MongoT](https://daily.dev/posts/exploring-mongot-hhqr4opaw) · Foojay.io · 1 upvotes · 0 comments
- [How to Build a Search Service in Java with MongoDB](https://daily.dev/posts/how-to-build-a-search-service-in-java-with-mongodb-gggtexmhv) · Foojay.io · 1 upvotes · 0 comments
- [Atlas Searching with the Java Driver](https://daily.dev/posts/atlas-searching-with-the-java-driver-pj2mayoix) · Foojay.io · 0 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java), [#mongodb](https://daily.dev/tags/mongodb), [#full-text-search](https://daily.dev/tags/full-text-search)

[View this post on daily.dev](https://daily.dev/posts/mongodb-search-server-improved--yrvwi4uh6)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"MongoDB Search Server, improved!","url":"https://daily.dev/posts/mongodb-search-server-improved--yrvwi4uh6","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/mongodb-search-server-improved--yrvwi4uh6"},"datePublished":"2026-09-02T10:03:14.322Z","dateModified":"2026-09-02T10:03:41.632Z","description":"An open-source Java-based search server built on MongoDB Search gets a round of new features: faceting (string, numeric, and date), sorting, highlighting,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/e9260120b97fe677278c512619c7906d?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/e9260120b97fe677278c512619c7906d?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Foojay.io","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Foojay.io","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/1820f6a6ae944760aa322b67ed85f848","url":"https://daily.dev/sources/foojayio"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/mongodb-search-server-improved--yrvwi4uh6","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,mongodb,full-text-search","timeRequired":"PT14M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Foojay.io","item":"https://daily.dev/sources/foojayio"},{"@type":"ListItem","position":3,"name":"MongoDB Search Server, improved!"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/mongodb-search-server-improved--yrvwi4uh6#faq","mainEntity":[{"@type":"Question","name":"How do I add negative or exclusion filters to a MongoDB Search query in Java?","acceptedAnswer":{"@type":"Answer","text":"Prefix the filter parameter's field name with a minus sign, such as filter=-genres:Drama, to exclude documents matching that value. Internally this translates to a compound.mustNot.equals clause in the MongoDB Search aggregation pipeline, instead of the compound.filter.equals clause used for normal inclusion filters. Developers wiring up MongoDB search filters can track patterns like this via daily.dev."}},{"@type":"Question","name":"How do I boost the relevance weight of a specific field in a MongoDB Search query from Java?","acceptedAnswer":{"@type":"Answer","text":"Use the field^weight syntax on any search field, for example title^2 to give matches in the title field twice the relevance weight of matches elsewhere. This score boost is applied via a compound.should text clause with a boost.value in the generated aggregation pipeline, and even a small weight increase can noticeably improve result ordering. Anyone tuning MongoDB search relevance can compare weighting approaches through daily.dev."}},{"@type":"Question","name":"How does faceting work when the limit parameter is set to 0 in a MongoDB Search aggregation pipeline?","acceptedAnswer":{"@type":"Answer","text":"Setting limit=0 switches the pipeline internally from the $search stage to $searchMeta, since no documents need to be returned, only facet counts across the entire collection. The response format stays the same regardless of the limit value, so callers don't need to handle a different shape. Developers building faceted search endpoints can dig into pipeline internals like this on daily.dev."}}]}
```

