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

indexes #252

Open
ghost opened this issue Nov 26, 2019 · 1 comment
Open

indexes #252

ghost opened this issue Nov 26, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 26, 2019

How would I go about creating indexes? I naively tried to put a json doc in a dir called "_index", it's not picked up. I tried to pushdocs that dir, but it failed on a missing _rev key while attempting to GET it as a regular doc.

@ghost
Copy link
Author

ghost commented Oct 21, 2020

A colleague figured it out. Indexes are stored in a design document. So you can add a design doc just as you would normally in couchapp, in the _design dir. Name it Indexes:

_design\Indexes\language

query

_design\Indexes\views.json

{
  "my-index": {
    "map": {
      "fields": {
        "exampleProperty": "desc"
      },
      "partial_filter_selector": {}
    },
    "reduce": "_count",
    "options": {
      "def": {
        "fields": [
          "exampleProperty"
        ]
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants