Skip to content

Commit 62ae5d6

Browse files
committed
Merge pull request #1000 from basho/fix/er/search-dt-upgrade
Using Search datatype and Upgrading layout fix
2 parents e98240b + 03059e0 commit 62ae5d6

File tree

3 files changed

+54
-35
lines changed

3 files changed

+54
-35
lines changed

source/languages/en/riak/dev/using/search.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,39 @@ to namespace all buckets you create. Bucket types have a lower
8787
overhead within the cluster than the default bucket namespace, but
8888
require an additional setup step in on commandline.
8989

90+
When creating a new bucket type, you can create a bucket type without
91+
any properties, and set individual buckets to be indexed.
92+
93+
```bash
94+
riak-admin bucket-type create animals '{"props":{}}'
95+
riak-admin bucket-type activate animals
96+
97+
curl -XPUT "$RIAK_HOST/types/animals/buckets/cats/props" \
98+
-H'content-type: application/json' \
99+
-d'{"props":{"search_index":"people"}}'
100+
```
101+
102+
Or optionally, you can set the `search_index` as a default property
103+
of the bucket type. This means any bucket under that type will
104+
inherit that setting and be its values will be indexed.
105+
90106
```bash
91107
riak-admin bucket-type create animals '{"props":{"search_index":"famous"}}'
92108
riak-admin bucket-type activate animals
93109
```
94110

111+
If you ever need to turn off indexing for a bucket, set `search_index`
112+
property to the `_dont_index_` sentinel.
113+
95114

96115
### Bucket Properties
97116

98-
If your Solr index is to be used by only one bucket, you can set the
99-
`search_index` property for a bucket in this manner:
117+
Although we recommend all new buckets use under a bucket type, if you have
118+
existing data with a type-free bucket (or under the `default` bucket type)
119+
you can set the `search_index` property for a bucket in this manner.
100120

101121
```curl
102-
curl -XPUT "$RIAK_HOST/buckets/animals/props" \
122+
curl -XPUT "$RIAK_HOST/buckets/cats/props" \
103123
-H'content-type:application/json' \
104124
-d'{"props":{"search_index":"famous"}}'
105125
```
@@ -149,23 +169,23 @@ curl -XPUT "$RIAK_HOST/types/animals/buckets/cats/keys/panthro" \
149169
-d'{"name_s":"Panthro", "age_i":36}'
150170
```
151171
```ruby
152-
bucket = client.bucket("animals", "cats")
172+
bucket = client.bucket("animals")
153173

154174
cat = bucket.get_or_new("liono")
155175
cat.data = {"name_s" => "Lion-o", "age_i" => 30, "leader_b" => true}
156-
cat.store
176+
cat.store(:bucket_type => "cats")
157177

158178
cat = bucket.get_or_new("cheetara")
159179
cat.data = {"name_s" => "Cheetara", "age_i" => 28, "leader_b" => false}
160-
cat.store
180+
cat.store(:bucket_type => "cats")
161181

162182
cat = bucket.get_or_new("snarf")
163183
cat.data = {"name_s" => "Snarf", "age_i" => 43}
164-
cat.store
184+
cat.store(:bucket_type => "cats")
165185

166186
cat = bucket.get_or_new("panthro")
167187
cat.data = {"name_s" => "Panthro", "age_i" => 36}
168-
cat.store
188+
cat.store(:bucket_type => "cats")
169189
```
170190
```python
171191
bucket = client.bucket('animals', 'cats')

source/languages/en/riak/ops/advanced/configs/search.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ Riak Search runs a Solr process per node to manage its index and search function
4545
Concerning ports, be sure to take the necessary security precautions to prevent exposing the extra solr and JMX ports to the outside world.
4646

4747

48-
<!-- connecting to JMX -->

source/languages/en/riak/ops/advanced/upgrading-search-2.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ audience: advanced
88
keywords: [search, upgrading]
99
---
1010

11-
If you're using Search in a version of Riak prior to 2.0 (1.3.0 to 1.4.x), you should follow these steps to migrate your search indexes from the legacy `merge_index`, to the new Solr backed ([[yokozuna|using riak search]]) indexes. The legacy version of Riak Search is now deprecated, and does not support most new 2.0 features (no [[datatypes]], [[bucket types|using bucket types]], [[strong consistency]], [[security]]), so we highly recommend you migrate. The legacy `merge_index` search will be removed in the future.
11+
If you're using Search in a version of Riak prior to 2.0 (1.3.0 to 1.4.x), you should follow these steps to migrate your search indexes from the legacy `merge_index`, to the new Solr backed ([[yokozuna|using search]]) indexes. The legacy version of Riak Search is now deprecated, and does not support most new 2.0 features (no [[datatypes|using data types]], [[bucket types|using bucket types]], [[strong consistency]], [[security|authentication and authorization]]), so we highly recommend you migrate. The legacy `merge_index` search will be removed in the future.
1212

1313
## Overview of an Upgrade
1414

@@ -22,50 +22,50 @@ You will continue running your queries against Riak Search in this phase. Once n
2222

2323
## Steps to Upgrading
2424

25-
1. First, you'll perform a normal [[rolling upgrade]]. As you upgrade, enable Yokozuna on each node using either `app.config` or the new `riak.conf` config option.
25+
1. First, you'll perform a normal [[rolling upgrade|rolling upgrades]]. As you upgrade, enable Yokozuna on each node using either `app.config` or the new `riak.conf` config option.
2626

27-
```appconfig
28-
{yokozuna, [
29-
{enabled, on}
30-
]},
31-
```
32-
```riakconf
33-
search = on
34-
```
27+
```appconfig
28+
{yokozuna, [
29+
{enabled, on}
30+
]},
31+
```
32+
```riakconf
33+
search = on
34+
```
3535
3636
2. For every index in Riak Search the user must create a comparable index in Yokozuna.
3737
38-
```curl
39-
# Run for each Riak node
38+
```curl
39+
# Run for each Riak node
4040
41-
export RIAK_HOST="http://localhost:8098"
41+
export RIAK_HOST="http://localhost:8098"
4242
43-
curl -XPUT "$RIAK_HOST/search/index/famous" \
44-
-H'content-type:application/json' \
45-
-d'{"schema":"_yz_default"}'
46-
```
47-
```erlang
48-
{ok, Ring} = riak_core_ring_manager:get_my_ring().
49-
{ok, PB} = riakc_pb_socket:start_link(IP, Port),
50-
riakc_pb_socket:create_search_index(Pid, <<"famous">>, <<"_yz_default">>, []),
51-
```
43+
curl -XPUT "$RIAK_HOST/search/index/famous" \
44+
-H'content-type:application/json' \
45+
-d'{"schema":"_yz_default"}'
46+
```
47+
```erlang
48+
{ok, Ring} = riak_core_ring_manager:get_my_ring().
49+
{ok, PB} = riakc_pb_socket:start_link(IP, Port),
50+
riakc_pb_socket:create_search_index(Pid, <<"famous">>, <<"_yz_default">>, []),
51+
```
5252
5353
5454
3. For every bucket which is indexed by Riak Search the user must add the `search_index' bucket property to point to the Yokozuna index which is going to eventually be migrated to.
5555
5656
4. As objects are written or modified they will be indexed by both Riak Search and Yokozuna. But the HTTP and PB query interfaces will continue to use Riak Search.
5757
58-
5a. The YZ AAE trees must be manually cleared so that AAE will notice the missing indexes.
58+
5. A. The YZ AAE trees must be manually cleared so that AAE will notice the missing indexes.
5959
60-
5b. In the background AAE will start building trees for Yokozuna and exchange them with KV. These exchanges will notice objects are missing and index them in Yokozuna.
60+
B. In the background AAE will start building trees for Yokozuna and exchange them with KV. These exchanges will notice objects are missing and index them in Yokozuna.
6161
62-
5c. The user wants Yokozuna to index the missing objects as fast as possible. A command may be used (repair? bucket map-reduce? custom fold function?) to immediately re-index data.
62+
C. The user wants Yokozuna to index the missing objects as fast as possible. A command may be used (repair? bucket map-reduce? custom fold function?) to immediately re-index data.
6363
6464
6. Eventually all partitions will be exchanged (or buckets re-indexed) and the user will be satisfied that queries can now migrate to Yokozuna. This will be accomplished via the AAE status.
6565
6666
7. The user will call some command that hands HTTP and PB query control to Yokozuna.
6767
68-
8. The user must then set the `search' bucket property to `false' for all indexed buckets.
68+
8. The user must then set the `search` bucket property to `false` for all indexed buckets.
6969
7070
9. Then the user can disable Riak Search on all nodes.
7171

0 commit comments

Comments
 (0)