Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
comp90024
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bojin LI
comp90024
Commits
e6cb47ae
Commit
e6cb47ae
authored
7 years ago
by
Luca Morandini
Browse files
Options
Downloads
Patches
Plain Diff
- Dropped time indexes section
parent
626d1d00
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
couchdb/README.md
+16
-32
16 additions, 32 deletions
couchdb/README.md
with
16 additions
and
32 deletions
couchdb/README.md
+
16
−
32
View file @
e6cb47ae
...
...
@@ -132,6 +132,7 @@ curl -XPOST "http://${user}:${pass}@${masternode}:5984/twitter/_bulk_docs " --he
Add a design document with MapReduce Views, Lists and Shows functions
```
grunt couch-compile
grunt couch-push
```
Request a MapReduce View
...
...
@@ -170,7 +171,18 @@ curl -XPOST "http://${user}:${pass}@${masternode}:5984/twitter/_find" \
}' | jq '.' -M
```
More complex Mango query, with tweets sorted by screen_name (it should fail, beacuse no index
Mango query explanation (use of indexes, or lack there-of, etc)
```
curl -XPOST "http://${user}:${pass}@${masternode}:5984/twitter/_explain" \
--header "Content-Type: application/json" --data '{
"fields" : ["_id", "text", "user.screen_name"],
"selector": {
"user.lang": {"$eq": "ja"}
}
}' | jq '.' -M
```
More complex Mango query, with tweets sorted by screen_name (it should fail, because no index
has been defined for the sort field)
```
curl -XPOST "http://${user}:${pass}@${masternode}:5984/twitter/_find" --header "Content-Type: application/json" --data '{
...
...
@@ -217,13 +229,14 @@ Get the list of indexes
```
curl -XGET "http://${user}:${pass}@${masternode}:5984/twitter/_index" | jq '.' -M
```
(Partial indexes selextor may be used to exclude some documents from indexing, in order to speed up indexing)
Indexes can be deleted as usual
```
curl -XDELETE "http://${user}:${pass}@${masternode}:5984/twitter/_index/indexes/json/lang-screen-index"
```
## Space
and time
indexes
## Space indexes
Index by location (works only for points, unfortunately)
```
...
...
@@ -251,35 +264,6 @@ curl -XPOST "http://${user}:${pass}@${masternode}:5984/twitter/_find" --header "
}' | jq '.' -M
```
Index by time ????
```
curl -XPOST "http://${user}:${pass}@${masternode}:5984/twitter/_index" \
--header "Content-Type: application/json" --data '{
"ddoc": "indexes",
"index": {
"fields": ["Date.parse(\"created_at\")"]
},
"name": "time",
"type": "json"
}'
```
```
curl -XPOST "http://${user}:${pass}@${masternode}:5984/twitter/_find" --header "Content-Type: application/json" --data '{
"fields" : ["_id", "user.lang", "user.screen_name", "text", "created_at", "coordinates"],
"use_index": ["indexes", "time"],
"selector": {
"$and": [
{"Date.parse(\"created_at\")": {"$gt": 1320386446000}},
{"Date.parse(\"created_at\")": {"$lt": 1478239246000}}
]
}
}' | jq '.' -M
```
Date.parse("Fri Nov 04 06:00:46 +0000 2011")
## Bookmarks for easier pagination than using skip and limit
## Docker container with full-text search
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment