-
Notifications
You must be signed in to change notification settings - Fork 9
/
dont_index_type.sh
executable file
·47 lines (47 loc) · 1.43 KB
/
dont_index_type.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
#
# Demonstrate the effect of disabling indexing of the type field
#
curl -XDELETE 'http://localhost:9200/test-idx'
curl -XPUT 'http://localhost:9200/test-idx' -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"not_indexed_type": {
"_type": {
"index": "no"
},
"properties": {
"message": {
"type": "string",
"store": "yes"
}
}
},
"indexed_type": {
"properties": {
"message": {
"type": "string",
"store": "yes"
}
}
}
}
}'
echo
curl -XGET 'http://localhost:9200/_cluster/health?wait_for_status=yellow'
echo
curl -XGET 'http://localhost:9200/test-idx/indexed_type/1' -d '{"message":"bar"}'
echo
curl -XGET 'http://localhost:9200/test-idx/not_indexed_type/2' -d '{"message":"bar"}'
echo
echo "---------------------------------------"
echo "Query expansion for non indexed type"
curl -XGET 'http://localhost:9200/test-idx/_validate/query?explain=true&q=not_indexed_type.message:bar&pretty=true'
echo
echo "---------------------------------------"
echo "Query expansion for indexed type"
curl -XGET 'http://localhost:9200/test-idx/not_indexed_type/_validate/query?explain=true&q=indexed_type.message:bar&pretty=true'
echo