Last active
December 23, 2015 13:39
-
-
Save nik9000/6643155 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
curl -XDELETE "http://localhost:9200/test?pretty" -s | |
curl -XPOST "http://localhost:9200/test?pretty" -s | |
curl -XGET 'http://localhost:9200/_cluster/health?pretty=true&wait_for_status=yellow' | |
curl -XPOST "http://localhost:9200/test/test/1?pretty" -d '{"foo": "findme"}' | |
curl -XPOST "http://localhost:9200/test/test/2?pretty" -d '{"bar": "findme"}' | |
curl -XPOST http://localhost:9200/test/_refresh?pretty | |
curl -XPOST "http://localhost:9200/test/test/_search?pretty&explain" -d '{ | |
"query": { | |
"query_string": { | |
"query": "findm*", | |
"fields": ["foo^20", "bar"] | |
} | |
} | |
}' | |
# { | |
# "took" : 2, | |
# "timed_out" : false, | |
# "_shards" : { | |
# "total" : 5, | |
# "successful" : 5, | |
# "failed" : 0 | |
# }, | |
# "hits" : { | |
# "total" : 2, | |
# "max_score" : 1.0, | |
# "hits" : [ { | |
# "_shard" : 3, | |
# "_node" : "sVwRSdM5RuCN77Eait9U5Q", | |
# "_index" : "test", | |
# "_type" : "test", | |
# "_id" : "2", | |
# "_score" : 1.0, "_source" : {"bar": "findme"}, | |
# "_explanation" : { | |
# "value" : 1.0, | |
# "description" : "max of:", | |
# "details" : [ { | |
# "value" : 1.0, | |
# "description" : "ConstantScore(bar:findm*), product of:", | |
# "details" : [ { | |
# "value" : 1.0, | |
# "description" : "boost" | |
# }, { | |
# "value" : 1.0, | |
# "description" : "queryNorm" | |
# } ] | |
# } ] | |
# } | |
# }, { | |
# "_shard" : 2, | |
# "_node" : "sVwRSdM5RuCN77Eait9U5Q", | |
# "_index" : "test", | |
# "_type" : "test", | |
# "_id" : "1", | |
# "_score" : 1.0, "_source" : {"foo": "findme"}, | |
# "_explanation" : { | |
# "value" : 1.0, | |
# "description" : "max of:", | |
# "details" : [ { | |
# "value" : 1.0, | |
# "description" : "ConstantScore(foo:findm*^20.0)^20.0, product of:", | |
# "details" : [ { | |
# "value" : 20.0, | |
# "description" : "boost" | |
# }, { | |
# "value" : 0.05, | |
# "description" : "queryNorm" | |
# } ] | |
# } ] | |
# } | |
# } ] | |
# } | |
# } | |
curl -XPOST "http://localhost:9200/test/test/_search?pretty&explain" -d '{ | |
"query": { | |
"bool": { | |
"should": [ { | |
"prefix": { | |
"foo": { | |
"value": "findm", | |
"boost": 20 | |
} | |
} | |
}, { | |
"prefix": { | |
"bar": "findm" | |
} | |
} ] | |
} | |
} | |
}' | |
# { | |
# "took" : 6, | |
# "timed_out" : false, | |
# "_shards" : { | |
# "total" : 5, | |
# "successful" : 5, | |
# "failed" : 0 | |
# }, | |
# "hits" : { | |
# "total" : 2, | |
# "max_score" : 0.5, | |
# "hits" : [ { | |
# "_shard" : 3, | |
# "_node" : "sVwRSdM5RuCN77Eait9U5Q", | |
# "_index" : "test", | |
# "_type" : "test", | |
# "_id" : "2", | |
# "_score" : 0.5, "_source" : {"bar": "findme"}, | |
# "_explanation" : { | |
# "value" : 0.5, | |
# "description" : "product of:", | |
# "details" : [ { | |
# "value" : 1.0, | |
# "description" : "sum of:", | |
# "details" : [ { | |
# "value" : 1.0, | |
# "description" : "ConstantScore(bar:findm*), product of:", | |
# "details" : [ { | |
# "value" : 1.0, | |
# "description" : "boost" | |
# }, { | |
# "value" : 1.0, | |
# "description" : "queryNorm" | |
# } ] | |
# } ] | |
# }, { | |
# "value" : 0.5, | |
# "description" : "coord(1/2)" | |
# } ] | |
# } | |
# }, { | |
# "_shard" : 2, | |
# "_node" : "sVwRSdM5RuCN77Eait9U5Q", | |
# "_index" : "test", | |
# "_type" : "test", | |
# "_id" : "1", | |
# "_score" : 0.5, "_source" : {"foo": "findme"}, | |
# "_explanation" : { | |
# "value" : 0.5, | |
# "description" : "product of:", | |
# "details" : [ { | |
# "value" : 1.0, | |
# "description" : "sum of:", | |
# "details" : [ { | |
# "value" : 1.0, | |
# "description" : "ConstantScore(foo:findm*^20.0)^20.0, product of:", | |
# "details" : [ { | |
# "value" : 20.0, | |
# "description" : "boost" | |
# }, { | |
# "value" : 0.05, | |
# "description" : "queryNorm" | |
# } ] | |
# } ] | |
# }, { | |
# "value" : 0.5, | |
# "description" : "coord(1/2)" | |
# } ] | |
# } | |
# } ] | |
# } | |
# } | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment