Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # DELETE
- curl -XDELETE 'http://localhost:9200/test'
- echo
- # DEFINE
- curl -XPUT 'http://localhost:9200/test/posts/_mapping?pretty=1' -d '{
- "posts" : {
- "properties" : {
- "section" : {
- "type" : "string"
- },
- "category" : {
- "type" : "string"
- },
- "title" : {
- "type" : "string"
- }
- }
- }
- }'
- echo
- # INSERT
- curl localhost:9200/test/posts/1 -d '{section: "Bicycle", category: "Small", title: "Diamondback Grind-16"}'
- curl localhost:9200/test/posts/2 -d '{section: "Bicycle", category: "Big", title: "Diamondback JrViper"}'
- curl localhost:9200/test/posts/3 -d '{section: "Bicycle", category: "Small", title: "2-Hip Cyclone Small"}'
- curl localhost:9200/test/posts/4 -d '{section: "Bicycle", category: "Big", title: "2-Hip Bizzle"}'
- curl localhost:9200/test/posts/5 -d '{section: "Small", category: "Small", title: "Toyota"}'
- curl localhost:9200/test/posts/6 -d '{section: "Car", category: "Big", title: "Subaru Impreza Small"}'
- curl localhost:9200/test/posts/7 -d '{section: "Small", category: "Big", title: "Toyota Corona MARK II"}'
- curl localhost:9200/test/posts/8 -d '{section: "Car", category: "Small", title: "Hyundai Elantra"}'
- curl localhost:9200/test/posts/9 -d '{section: "Car", category: "Big", title: "Ford Maverick small"}'
- echo
- # REFRESH
- curl -XPOST localhost:9200/test/_refresh
- echo
- # SEARCH
- curl "localhost:9200/test/posts/_search?pretty=1" -d '{
- "query" : {
- "bool": {
- "must": [
- {
- "multi_match": {
- "query": "small",
- "fields": ["section^100", "category^10", "title"],
- "use_dis_max": "false"
- }
- }
- ]
- }
- },
- "explain": "true"
- }'
- # RESULTS
- {
- "took": 73,
- "timed_out": false,
- "_shards": {
- "total": 5,
- "successful": 5,
- "failed": 0
- },
- "hits": {
- "total": 7,
- "max_score": 0.32860997,
- "hits": [{
- "_shard": 3,
- "_node": "orjzC90ISLKZY7Zq4edY3g",
- "_index": "test",
- "_type": "posts",
- "_id": "7",
- "_score": 0.32860997, "_source": {section: "Small", category: "Big", title: "Toyota Corona MARK II"},
- "_explanation": {
- "value": 0.32860997,
- "description": "product of:",
- "details": [{
- "value": 0.9858299,
- "description": "sum of:",
- "details": [{
- "value": 0.9858299,
- "description": "weight(section:small^100.0 in 1) [PerFieldSimilarity], result of:",
- "details": [{
- "value": 0.9858299,
- "description": "score(doc=1,freq=1.0 = termFreq=1.0\n), product of:",
- "details": [{
- "value": 0.9858299,
- "description": "queryWeight, product of:",
- "details": [{
- "value": 100.0,
- "description": "boost"
- }, {
- "value": 1.0,
- "description": "idf(docFreq=1, maxDocs=2)"
- }, {
- "value": 0.009858299,
- "description": "queryNorm"
- }]
- }, {
- "value": 1.0,
- "description": "fieldWeight in 1, product of:",
- "details": [{
- "value": 1.0,
- "description": "tf(freq=1.0), with freq of:",
- "details": [{
- "value": 1.0,
- "description": "termFreq=1.0"
- }]
- }, {
- "value": 1.0,
- "description": "idf(docFreq=1, maxDocs=2)"
- }, {
- "value": 1.0,
- "description": "fieldNorm(doc=1)"
- }]
- }]
- }]
- }]
- }, {
- "value": 0.33333334,
- "description": "coord(1/3)"
- }]
- }
- }, {
- "_shard": 1,
- "_node": "orjzC90ISLKZY7Zq4edY3g",
- "_index": "test",
- "_type": "posts",
- "_id": "5",
- "_score": 0.22379102, "_source": {section: "Small", category: "Small", title: "Toyota"},
- "_explanation": {
- "value": 0.223791,
- "description": "product of:",
- "details": [{
- "value": 0.3356865,
- "description": "sum of:",
- "details": [{
- "value": 0.030516956,
- "description": "weight(category:small^10.0 in 0) [PerFieldSimilarity], result of:",
- "details": [{
- "value": 0.030516956,
- "description": "score(doc=0,freq=1.0 = termFreq=1.0\n), product of:",
- "details": [{
- "value": 0.099451445,
- "description": "queryWeight, product of:",
- "details": [{
- "value": 10.0,
- "description": "boost"
- }, {
- "value": 0.30685282,
- "description": "idf(docFreq=1, maxDocs=1)"
- }, {
- "value": 0.032410145,
- "description": "queryNorm"
- }]
- }, {
- "value": 0.30685282,
- "description": "fieldWeight in 0, product of:",
- "details": [{
- "value": 1.0,
- "description": "tf(freq=1.0), with freq of:",
- "details": [{
- "value": 1.0,
- "description": "termFreq=1.0"
- }]
- }, {
- "value": 0.30685282,
- "description": "idf(docFreq=1, maxDocs=1)"
- }, {
- "value": 1.0,
- "description": "fieldNorm(doc=0)"
- }]
- }]
- }]
- }, {
- "value": 0.30516955,
- "description": "weight(section:small^100.0 in 0) [PerFieldSimilarity], result of:",
- "details": [{
- "value": 0.30516955,
- "description": "score(doc=0,freq=1.0 = termFreq=1.0\n), product of:",
- "details": [{
- "value": 0.9945144,
- "description": "queryWeight, product of:",
- "details": [{
- "value": 100.0,
- "description": "boost"
- }, {
- "value": 0.30685282,
- "description": "idf(docFreq=1, maxDocs=1)"
- }, {
- "value": 0.032410145,
- "description": "queryNorm"
- }]
- }, {
- "value": 0.30685282,
- "description": "fieldWeight in 0, product of:",
- "details": [{
- "value": 1.0,
- "description": "tf(freq=1.0), with freq of:",
- "details": [{
- "value": 1.0,
- "description": "termFreq=1.0"
- }]
- }, {
- "value": 0.30685282,
- "description": "idf(docFreq=1, maxDocs=1)"
- }, {
- "value": 1.0,
- "description": "fieldNorm(doc=0)"
- }]
- }]
- }]
- }]
- }, {
- "value": 0.6666667,
- "description": "coord(2/3)"
- }]
- }
- }, {
- "_shard": 2,
- "_node": "orjzC90ISLKZY7Zq4edY3g",
- "_index": "test",
- "_type": "posts",
- "_id": "1",
- "_score": 0.019652616, "_source": {section: "Bicycle", category: "Small", title: "Diamondback Grind-16"},
- "_explanation": {
- "value": 0.019652616,
- "description": "product of:",
- "details": [{
- "value": 0.058957845,
- "description": "sum of:",
- "details": [{
- "value": 0.058957845,
- "description": "weight(category:small^10.0 in 0) [PerFieldSimilarity], result of:",
- "details": [{
- "value": 0.058957845,
- "description": "score(doc=0,freq=1.0 = termFreq=1.0\n), product of:",
- "details": [{
- "value": 0.058957845,
- "description": "queryWeight, product of:",
- "details": [{
- "value": 10.0,
- "description": "boost"
- }, {
- "value": 1.0,
- "description": "idf(docFreq=1, maxDocs=2)"
- }, {
- "value": 0.0058957846,
- "description": "queryNorm"
- }]
- }, {
- "value": 1.0,
- "description": "fieldWeight in 0, product of:",
- "details": [{
- "value": 1.0,
- "description": "tf(freq=1.0), with freq of:",
- "details": [{
- "value": 1.0,
- "description": "termFreq=1.0"
- }]
- }, {
- "value": 1.0,
- "description": "idf(docFreq=1, maxDocs=2)"
- }, {
- "value": 1.0,
- "description": "fieldNorm(doc=0)"
- }]
- }]
- }]
- }]
- }, {
- "value": 0.33333334,
- "description": "coord(1/3)"
- }]
- }
- }, {
- "_shard": 4,
- "_node": "orjzC90ISLKZY7Zq4edY3g",
- "_index": "test",
- "_type": "posts",
- "_id": "3",
- "_score": 0.015876401, "_source": {section: "Bicycle", category: "Small", title: "2-Hip Cyclone Small"},
- "_explanation": {
- "value": 0.015876401,
- "description": "product of:",
- "details": [{
- "value": 0.0238146,
- "description": "sum of:",
- "details": [{
- "value": 0.0029512104,
- "description": "weight(title:small in 0) [PerFieldSimilarity], result of:",
- "details": [{
- "value": 0.0029512104,
- "description": "score(doc=0,freq=1.0 = termFreq=1.0\n), product of:",
- "details": [{
- "value": 0.0059024207,
- "description": "queryWeight, product of:",
- "details": [{
- "value": 1.0,
- "description": "idf(docFreq=1, maxDocs=2)"
- }, {
- "value": 0.0059024207,
- "description": "queryNorm"
- }]
- }, {
- "value": 0.5,
- "description": "fieldWeight in 0, product of:",
- "details": [{
- "value": 1.0,
- "description": "tf(freq=1.0), with freq of:",
- "details": [{
- "value": 1.0,
- "description": "termFreq=1.0"
- }]
- }, {
- "value": 1.0,
- "description": "idf(docFreq=1, maxDocs=2)"
- }, {
- "value": 0.5,
- "description": "fieldNorm(doc=0)"
- }]
- }]
- }]
- }, {
- "value": 0.02086339,
- "description": "weight(category:small^10.0 in 0) [PerFieldSimilarity], result of:",
- "details": [{
- "value": 0.02086339,
- "description": "score(doc=0,freq=1.0 = termFreq=1.0\n), product of:",
- "details": [{
- "value": 0.03509195,
- "description": "queryWeight, product of:",
- "details": [{
- "value": 10.0,
- "description": "boost"
- }, {
- "value": 0.5945349,
- "description": "idf(docFreq=2, maxDocs=2)"
- }, {
- "value": 0.0059024207,
- "description": "queryNorm"
- }]
- }, {
- "value": 0.5945349,
- "description": "fieldWeight in 0, product of:",
- "details": [{
- "value": 1.0,
- "description": "tf(freq=1.0), with freq of:",
- "details": [{
- "value": 1.0,
- "description": "termFreq=1.0"
- }]
- }, {
- "value": 0.5945349,
- "description": "idf(docFreq=2, maxDocs=2)"
- }, {
- "value": 1.0,
- "description": "fieldNorm(doc=0)"
- }]
- }]
- }]
- }]
- }, {
- "value": 0.6666667,
- "description": "coord(2/3)"
- }]
- }
- }, {
- "_shard": 4,
- "_node": "orjzC90ISLKZY7Zq4edY3g",
- "_index": "test",
- "_type": "posts",
- "_id": "8",
- "_score": 0.006954463, "_source": {section: "Car", category: "Small", title: "Hyundai Elantra"},
- "_explanation": {
- "value": 0.006954463,
- "description": "product of:",
- "details": [{
- "value": 0.02086339,
- "description": "sum of:",
- "details": [{
- "value": 0.02086339,
- "description": "weight(category:small^10.0 in 1) [PerFieldSimilarity], result of:",
- "details": [{
- "value": 0.02086339,
- "description": "score(doc=1,freq=1.0 = termFreq=1.0\n), product of:",
- "details": [{
- "value": 0.03509195,
- "description": "queryWeight, product of:",
- "details": [{
- "value": 10.0,
- "description": "boost"
- }, {
- "value": 0.5945349,
- "description": "idf(docFreq=2, maxDocs=2)"
- }, {
- "value": 0.0059024207,
- "description": "queryNorm"
- }]
- }, {
- "value": 0.5945349,
- "description": "fieldWeight in 1, product of:",
- "details": [{
- "value": 1.0,
- "description": "tf(freq=1.0), with freq of:",
- "details": [{
- "value": 1.0,
- "description": "termFreq=1.0"
- }]
- }, {
- "value": 0.5945349,
- "description": "idf(docFreq=2, maxDocs=2)"
- }, {
- "value": 1.0,
- "description": "fieldNorm(doc=1)"
- }]
- }]
- }]
- }]
- }, {
- "value": 0.33333334,
- "description": "coord(1/3)"
- }]
- }
- }, {
- "_shard": 2,
- "_node": "orjzC90ISLKZY7Zq4edY3g",
- "_index": "test",
- "_type": "posts",
- "_id": "6",
- "_score": 9.826308E-4, "_source": {section: "Car", category: "Big", title: "Subaru Impreza Small"},
- "_explanation": {
- "value": 9.826308E-4,
- "description": "product of:",
- "details": [{
- "value": 0.0029478923,
- "description": "sum of:",
- "details": [{
- "value": 0.0029478923,
- "description": "weight(title:small in 1) [PerFieldSimilarity], result of:",
- "details": [{
- "value": 0.0029478923,
- "description": "score(doc=1,freq=1.0 = termFreq=1.0\n), product of:",
- "details": [{
- "value": 0.0058957846,
- "description": "queryWeight, product of:",
- "details": [{
- "value": 1.0,
- "description": "idf(docFreq=1, maxDocs=2)"
- }, {
- "value": 0.0058957846,
- "description": "queryNorm"
- }]
- }, {
- "value": 0.5,
- "description": "fieldWeight in 1, product of:",
- "details": [{
- "value": 1.0,
- "description": "tf(freq=1.0), with freq of:",
- "details": [{
- "value": 1.0,
- "description": "termFreq=1.0"
- }]
- }, {
- "value": 1.0,
- "description": "idf(docFreq=1, maxDocs=2)"
- }, {
- "value": 0.5,
- "description": "fieldNorm(doc=1)"
- }]
- }]
- }]
- }]
- }, {
- "value": 0.33333334,
- "description": "coord(1/3)"
- }]
- }
- }, {
- "_shard": 0,
- "_node": "orjzC90ISLKZY7Zq4edY3g",
- "_index": "test",
- "_type": "posts",
- "_id": "9",
- "_score": 9.794582E-4, "_source": {section: "Car", category: "Big", title: "Ford Maverick small"},
- "_explanation": {
- "value": 9.794582E-4,
- "description": "product of:",
- "details": [{
- "value": 0.0029383744,
- "description": "sum of:",
- "details": [{
- "value": 0.0029383744,
- "description": "weight(title:small in 1) [PerFieldSimilarity], result of:",
- "details": [{
- "value": 0.0029383744,
- "description": "score(doc=1,freq=1.0 = termFreq=1.0\n), product of:",
- "details": [{
- "value": 0.005876749,
- "description": "queryWeight, product of:",
- "details": [{
- "value": 1.0,
- "description": "idf(docFreq=1, maxDocs=2)"
- }, {
- "value": 0.005876749,
- "description": "queryNorm"
- }]
- }, {
- "value": 0.5,
- "description": "fieldWeight in 1, product of:",
- "details": [{
- "value": 1.0,
- "description": "tf(freq=1.0), with freq of:",
- "details": [{
- "value": 1.0,
- "description": "termFreq=1.0"
- }]
- }, {
- "value": 1.0,
- "description": "idf(docFreq=1, maxDocs=2)"
- }, {
- "value": 0.5,
- "description": "fieldNorm(doc=1)"
- }]
- }]
- }]
- }]
- }, {
- "value": 0.33333334,
- "description": "coord(1/3)"
- }]
- }
- }]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment