🌈 Improvements
Easy search over your network of machines
useNetwork field in POST /indexes/{:indexUid}/search
The search query object passed in the body of POST /indexes/{:indexUid}/search now accepts an optional boolean useNetwork. When present and set to true, the search is executed "as-if" it was a remote federated search over all remotes in the network.
That is, the following:
Search request
Is executed by Meilisearch as if it was the following, assuming a network of 3 Meilisearch instances with names "0", "1" and "2":
Equivalent multi-search request
// POST /multi-search
{
"federation": {
"limit": 5,
"facetsByIndex": {
"movies": [
"genres"
]
},
"merge": {}
},
"queries": [
{
"indexUid": "movies",
"federationOptions": {
"remote": "0"
},
"q": "Batman dark knight returns 1",
"filter": "genres IN [Action, Adventure]"
},
{
"indexUid": "movies",
"federationOptions": {
"remote": "1"
},
"q": "Batman dark knight returns 1",
"filter": "genres IN [Action, Adventure]"
},
{
"indexUid": "movies",
"federationOptions": {
"remote": "2"
},
"q": "Batman dark knight returns 1",
"filter": "genres IN [Action, Adventure]"
}
]
}
Resulting in:
Search Response
{
"hits": [
{
"id": 123025,
"title": "Batman: The Dark Knight Returns, Part 1",
"overview": "Batman has not been seen for ten years. A new breed of criminal ravages Gotham City, forcing 55-year-old Bruce Wayne back into the cape and cowl. But, does he still have what it takes to fight crime in a new era?",
"genres": [
"Action",
"Animation",
"Mystery"
],
"poster": "https://image.tmdb.org/t/p/w500/kkjTbwV1Xnj8wBL52PjOcXzTbnb.jpg",
"release_date": 1345507200,
"_federation": {
"indexUid": "mieli",
"queriesPosition": 2,
"weightedRankingScore": 0.9894586894586894,
"remote": "2"
}
},
{
"id": 142061,
"title": "Batman: The Dark Knight Returns, Part 2",
"overview": "Batman has stopped the reign of terror that The Mutants had cast upon his city. Now an old foe wants a reunion and the government wants The Man of Steel to put a stop to Batman.",
"genres": [
"Action",
"Animation",
"Mystery"
],
"poster": "https://image.tmdb.org/t/p/w500/arEZYd6uMOFTILne9Ux0A8qctMe.jpg",
"release_date": 1357171200,
"_federation": {
"indexUid": "mieli",
"queriesPosition": 1,
"weightedRankingScore": 0.9894558963186414,
"remote": "1"
}
},
{
"id": 16234,
"title": "Batman Beyond: Return of the Joker",
"overview": "The Joker is back with a vengeance, and Gotham's newest Dark Knight needs answers as he stands alone to face Gotham's most infamous Clown Prince of Crime.",
"genres": [
"Animation",
"Family",
"Action",
"Science Fiction"
],
"poster": "https://image.tmdb.org/t/p/w500/7RlBs0An83fqAuKfwH5gKMcqgMc.jpg",
"release_date": 976579200,
"_federation": {
"indexUid": "mieli",
"queriesPosition": 1,
"weightedRankingScore": 0.9427964918160996,
"remote": "1"
}
},
{
"id": 155,
"title": "The Dark Knight",
"overview": "Batman raises the stakes in his war on crime. With the help of Lt. Jim Gordon and District Attorney Harvey Dent, Batman sets out to dismantle the remaining criminal organizations that plague the streets. The partnership proves to be effective, but they soon find themselves prey to a reign of chaos unleashed by a rising criminal mastermind known to the terrified citizens of Gotham as the Joker.",
"genres": [
"Drama",
"Action",
"Crime",
"Thriller"
],
"poster": "https://image.tmdb.org/t/p/w500/qJ2tW6WMUDux911r6m7haRef0WH.jpg",
"release_date": 1216166400,
"_federation": {
"indexUid": "mieli",
"queriesPosition": 1,
"weightedRankingScore": 0.5784178187403994,
"remote": "1"
}
},
{
"id": 49026,
"title": "The Dark Knight Rises",
"overview": "Following the death of District Attorney Harvey Dent, Batman assumes responsibility for Dent's crimes to protect the late attorney's reputation and is subsequently hunted by the Gotham City Police Department. Eight years later, Batman encounters the mysterious Selina Kyle and the villainous Bane, a new terrorist leader who overwhelms Gotham's finest. The Dark Knight resurfaces to protect a city that has branded him an enemy.",
"genres": [
"Action",
"Crime",
"Drama",
"Thriller"
],
"poster": "https://image.tmdb.org/t/p/w500/vzvKcPQ4o7TjWeGIn0aGC9FeVNu.jpg",
"release_date": 1342396800,
"_federation": {
"indexUid": "mieli",
"queriesPosition": 2,
"weightedRankingScore": 0.5772657450076805,
"remote": "2"
}
}
],
"query": "Batman dark knight returns 1",
"processingTimeMs": 173,
"limit": 5,
"offset": 0,
"estimatedTotalHits": 47,
"facetDistribution": {
"genres": {
"Action": 46,
"Adventure": 15,
"Animation": 34,
"Comedy": 3,
"Crime": 14,
"Drama": 6,
"Family": 15,
"Fantasy": 8,
"Horror": 1,
"Mystery": 4,
"Romance": 1,
"Science Fiction": 14,
"TV Movie": 4,
"Thriller": 4,
"Western": 1
}
},
"facetStats": {},
"requestUid": "019bbcf4-a609-7701-8d82-d370611adfb3",
"remoteErrors": {}
}
useNetwork requires the network experimental feature to be enabled.
useNetwork query parameter in GET /indexes/{:indexUid}/search
Passing useNetwork=true as a query parameter to GET /indexes/{:indexUid}/search has the same effect as passing useNetwork: true as a field parameter to POST /indexes/{:indexUid}/search
.queries[].useNetwork field in POST /multi-search
useNetworkcan also be passed as a field of the individual queries inside of amulti-searchrequest.- When used on a query in a non-federated search request, it has the same effect as on
POST /indexes/{:indexUid}/searchfor that query - When used on a query in a federated search request, the request is executed "as-if" one query per remote of the network had been performed.
Federated search example:
Multi-search request
{
"federation": {
"limit": 5
},
"queries": [
{
"q": "Batman returns",
"indexUid": "mieli",
"useNetwork": true
},
{
"q": "Superman returns",
"indexUid": "mieli",
"useNetwork": true
}
]
}Multi-search response
{
"hits": [
{
"id": 364,
"title": "Batman Returns",
"overview": "While Batman deals with a deformed man calling himself the Penguin, an employee of a corrupt businessman transforms into the Catwoman.",
"genres": [
"Action",
"Fantasy"
],
"poster": "https://image.tmdb.org/t/p/w500/jKBjeXM7iBBV9UkUcOXx3m7FSHY.jpg",
"release_date": 708912000,
"_federation": {
"indexUid": "mieli",
"queriesPosition": 0,
"weightedRankingScore": 1.0,
"remote": "1"
}
},
{
"id": 1452,
"title": "Superman Returns",
"overview": "Superman returns to discover his 5-year absence has allowed Lex Luthor to walk free, and that those he was closest to felt abandoned and have moved on. Luthor plots his ultimate revenge that could see millions killed and change the face of the planet forever, as well as ridding himself of the Man of Steel.",
"genres": [
"Science Fiction",
"Action",
"Adventure"
],
"poster": "https://image.tmdb.org/t/p/w500/qIegbn6DSUYmggfwxOBNOVS35q.jpg",
"release_date": 1151452800,
"_federation": {
"indexUid": "mieli",
"queriesPosition": 1,
"weightedRankingScore": 1.0,
"remote": "0"
}
},
{
"id": 324249,
"title": "Requiem for Krypton: Making 'Superman Returns'",
"overview": "A detailed behind-the-scenes documentary on the making of Superman Returns.",
"genres": [
"Documentary"
],
"poster": "https://image.tmdb.org/t/p/w500/eC1XKswKSoyDyJXXZszLTuwUHli.jpg",
"release_date": 1164672000,
"_federation": {
"indexUid": "mieli",
"queriesPosition": 1,
"weightedRankingScore": 0.9907407407407408,
"remote": "1"
}
},
{
"id": 294294,
"title": "Saltwater",
"overview": "This American Indie drama follows several endearing characters as they wade through life seeking happiness, peace and ultimately, love. Will (Ronnie Kerr, Vampire Boys 2, Shut Up and Kiss Me) leaves the Navy after many years, soon reunites old friends and begins to start his new civilian life. His friend Rich (Bruce L Hart) tries to set him up with ruggedly handsome Josh (Ian Roberts-a former Australian professional rugby player, actor and model-Cedar Boys, Superman Returns, Little Fish). While there is immense chemistry between the two, timing and certain ideals never seem to align. When a shocking tragedy happens the two are paired up to pick up the pieces and sort through the after effects. Saltwater is a story about men of all ages, finding love, losing friends, navigating their way through life and knowing it's the journey rather then the destination that's important.",
"genres": [
"Romance",
"Drama"
],
"poster": "https://image.tmdb.org/t/p/w500/bDnLdYqpH9abHo4ASMPKiInx8dm.jpg",
"release_date": 1342310400,
"_federation": {
"indexUid": "mieli",
"queriesPosition": 1,
"weightedRankingScore": 0.966931216931217,
"remote": "1"
}
},
{
"id": 142061,
"title": "Batman: The Dark Knight Returns, Part 2",
"overview": "Batman has stopped the reign of terror that The Mutants had cast upon his city. Now an old foe wants a reunion and the government wants The Man of Steel to put a stop to Batman.",
"genres": [
"Action",
"Animation",
"Mystery"
],
"poster": "https://image.tmdb.org/t/p/w500/arEZYd6uMOFTILne9Ux0A8qctMe.jpg",
"release_date": 1357171200,
"_federation": {
"indexUid": "mieli",
"queriesPosition": 0,
"weightedRankingScore": 0.8697089947089947,
"remote": "1"
}
}
],
"processingTimeMs": 247,
"limit": 5,
"offset": 0,
"estimatedTotalHits": 97,
"requestUid": "019bbd3a-5106-70e0-94fc-f58b2f0c28c8",
"remoteErrors": {}
}
Limitations
- Facet search referencing
useNetworkare not supported - The chat route cannot use
useNetworkat the moment: doing so is not trivial implementation-wise, because chat route expects to be able to open the index (to fetch chat configs), but federated search only opens the indexes once during a short critical section.
Federated search supports page and hitsPerPage
Pass federation.page and federation.hitsPerPage with the same meaning as in a regular search request to use exhaustive pagination in the federated search
Speed up settings changes when removing searchable
The settings indexer is more efficient when users are removing searchable attributes from the searchable fields.
By @VedantMadane in #6109
🔒 Security
Solves a low-severity timing attack vulnerability on key comparison by using constant-time comparison
🔩 Maintenance
Remove some unwanted dependencies
- Remove openssl from deps by @dureuill in #6117
- Fix geo-types version to avoid multiple rstar deps by @dureuill in #6118
New Contributors
❤️ Thanks again @VedantMadane for the contribution to this release!
Full Changelog: v1.33.1...v1.34.0