Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental features #3850

Merged
merged 9 commits into from
Jun 26, 2023
Merged

Experimental features #3850

merged 9 commits into from
Jun 26, 2023

Conversation

dureuill
Copy link
Contributor

@dureuill dureuill commented Jun 22, 2023

Pull Request

Related issue

What does this PR do?

Example

Using the feature to enable `scoreDetails`
❯ curl \
  -X POST 'http://localhost:7700/indexes/index-word-count-10-count/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "Batman", "limit": 1, "showRankingScoreDetails": true, "attributesToRetrieve": ["title"]}' | jsonxf

{
  "message": "Computing score details requires enabling the `score details` experimental feature. See https://github.com/meilisearch/product/discussions/674",
  "code": "feature_not_enabled",
  "type": "invalid_request",
  "link": "https://docs.meilisearch.com/errors#feature_not_enabled"
}
❯ curl \
  -X PATCH 'http://localhost:7700/experimental-features/' \
  -H 'Content-Type: application/json'  \
--data-binary '{
    "scoreDetails": true
  }'
{"scoreDetails":true,"vectorSearch":false}
❯ curl \
  -X POST 'http://localhost:7700/indexes/index-word-count-10-count/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "Batman", "limit": 1, "showRankingScoreDetails": true, "attributesToRetrieve": ["title"]}' | jsonxf
{
  "hits": [
    {
      "title": "Batman",
      "_rankingScoreDetails": {
        "words": {
          "order": 0,
          "matchingWords": 1,
          "maxMatchingWords": 1,
          "score": 1.0
        },
        "typo": {
          "order": 1,
          "typoCount": 0,
          "maxTypoCount": 1,
          "score": 1.0
        },
        "proximity": {
          "order": 2,
          "score": 1.0
        },
        "attribute": {
          "order": 3,
          "attribute_ranking_order_score": 1.0,
          "query_word_distance_score": 1.0,
          "score": 1.0
        },
        "exactness": {
          "order": 4,
          "matchType": "exactMatch",
          "score": 1.0
        }
      }
    }
  ],
  "query": "Batman",
  "processingTimeMs": 3,
  "limit": 1,
  "offset": 0,
  "estimatedTotalHits": 46
}

User standpoint

  • Add new route GET/POST/PATCH/DELETE /experimental-features to switch on or off some of the experimental features in a manner persistent between instance restarts
  • Use these new routes to allow setting on/off the following experimental features:
  • Make the way of checking feature availability and error message uniform for the Prometheus metrics experimental feature
  • Save the enabled features in dump, restore from dumps
  • TODO: tests:
    • Test new security permissions (do they allow access with ALL, do they prevent access when missing)
    • Test dump behavior, in particular ability to import existing v6 dumps
    • Test basic behavior when calling the rule

Implementation standpoint

  • New DB "experimental-features"
  • dumps are modified to save the state of that new DB as a experimental-features.json file, that is then loaded back when importing the dump. This doesn't change the dump version, as the file is optional and it missing will not cause the dump to fail

@dureuill dureuill added this to the v1.3.0 milestone Jun 22, 2023
@dureuill dureuill changed the base branch from main to recursive_bucket_score June 22, 2023 21:20
Base automatically changed from recursive_bucket_score to main June 26, 2023 10:03
@dureuill dureuill requested a review from Kerollmops June 26, 2023 14:34
@dureuill dureuill added the experimental feature Related to an experimental feature label Jun 26, 2023
Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much 🍩
bors merge

meili-bors bot added a commit that referenced this pull request Jun 26, 2023
3850: Experimental features r=Kerollmops a=dureuill

# Pull Request

## Related issue

Fixes #3857

## What does this PR do?

### Example

<details>
<summary>Using the feature to enable `scoreDetails`</summary>

```json
❯ curl \
  -X POST 'http://localhost:7700/indexes/index-word-count-10-count/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "Batman", "limit": 1, "showRankingScoreDetails": true, "attributesToRetrieve": ["title"]}' | jsonxf

{
  "message": "Computing score details requires enabling the `score details` experimental feature. See https://github.com/meilisearch/product/discussions/674",
  "code": "feature_not_enabled",
  "type": "invalid_request",
  "link": "https://docs.meilisearch.com/errors#feature_not_enabled"
}
```

```json
❯ curl \
  -X PATCH 'http://localhost:7700/experimental-features/' \
  -H 'Content-Type: application/json'  \
--data-binary '{
    "scoreDetails": true
  }'
{"scoreDetails":true,"vectorSearch":false}
```

```json
❯ curl \
  -X POST 'http://localhost:7700/indexes/index-word-count-10-count/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "Batman", "limit": 1, "showRankingScoreDetails": true, "attributesToRetrieve": ["title"]}' | jsonxf
{
  "hits": [
    {
      "title": "Batman",
      "_rankingScoreDetails": {
        "words": {
          "order": 0,
          "matchingWords": 1,
          "maxMatchingWords": 1,
          "score": 1.0
        },
        "typo": {
          "order": 1,
          "typoCount": 0,
          "maxTypoCount": 1,
          "score": 1.0
        },
        "proximity": {
          "order": 2,
          "score": 1.0
        },
        "attribute": {
          "order": 3,
          "attribute_ranking_order_score": 1.0,
          "query_word_distance_score": 1.0,
          "score": 1.0
        },
        "exactness": {
          "order": 4,
          "matchType": "exactMatch",
          "score": 1.0
        }
      }
    }
  ],
  "query": "Batman",
  "processingTimeMs": 3,
  "limit": 1,
  "offset": 0,
  "estimatedTotalHits": 46
}
```


</details>

### User standpoint

- Add new route GET/POST/PATCH/DELETE `/experimental-features` to switch on or off some of the experimental features in a manner persistent between instance restarts
- Use these new routes to allow setting on/off the following experimental features:
  - vector store **TODO:** fill in issue 
  - score details
- Make the way of checking feature availability and error message uniform for the Prometheus metrics experimental feature
- Save the enabled features in dump, restore from dumps
- **TODO:** tests:
  - Test new security permissions (do they allow access with ALL, do they prevent access when missing)
  - Test dump behavior, in particular ability to import existing v6 dumps
  - Test basic behavior when calling the rule 

### Implementation standpoint

- New DB "experimental-features"
- dumps are modified to save the state of that new DB as a `experimental-features.json` file, that is then loaded back when importing the dump. This doesn't change the dump version, as the file is optional and it missing will not cause the dump to fail

Co-authored-by: Louis Dureuil <[email protected]>
@meili-bors
Copy link
Contributor

meili-bors bot commented Jun 26, 2023

Build failed:

  • Tests on macos-12

@Kerollmops
Copy link
Member

I hope it's just a spurious test 🤞
bors merge

@dureuill
Copy link
Contributor Author

dureuill commented Jun 26, 2023

I hope it's just a spurious test 🤞

Looks like many workflows failed on macos this afternoon.

Maybe a shared runner has trouble coping with multiple PRs at once?

@meili-bors
Copy link
Contributor

meili-bors bot commented Jun 26, 2023

Build succeeded:

@dureuill dureuill merged commit f105df6 into main Jun 26, 2023
@dureuill dureuill deleted the experimental_features branch June 26, 2023 15:44
meili-bors bot added a commit that referenced this pull request Jun 27, 2023
3859: Merge all analytics events pertaining to updating the experimental features r=Kerollmops a=dureuill

Follow-up to #3850 

Co-authored-by: Louis Dureuil <[email protected]>
@meili-bot meili-bot added the v1.3.0 PRs/issues solved in v1.3.0 released on 2023-07-31 label Aug 2, 2023
@irevoire irevoire added the version upgrade Anything related to the way we update a meilisearch instance label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental feature Related to an experimental feature v1.3.0 PRs/issues solved in v1.3.0 released on 2023-07-31 version upgrade Anything related to the way we update a meilisearch instance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for enabling some experimental features at runtime
4 participants