Last active
December 27, 2015 13:09
-
-
Save roytmana/7330956 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
//note yuo can replace documents created below with these to make it even more obvious | |
//the difference is that i do not supply non-multifield "key" property to influence scores | |
curl -XPOST "http://localhost:9200/test/ht/" -d' | |
{"name":"john", "junk":"doug"}' | |
curl -XPOST "http://localhost:9200/test/ht/" -d' | |
{"name":"alex", "junk":"john"}' | |
curl -XPOST "http://localhost:9200/test/ht/" -d' | |
{"name":"bob", "junk":"john"}' | |
curl -XPOST "http://localhost:9200/test/ht/" -d' | |
{"name":"sean", "junk":"john"}' | |
curl -XPOST "http://localhost:9200/test/ht/" -d' | |
{"name":"matt", "junk":"john"}' | |
curl -XDELETE http://localhost:9200/test | |
curl -XPOST "http://localhost:9200/test/ht/" -d'{ | |
"settings": { | |
"number_of_shards": 1, | |
"number_of_replicas": 0 | |
}, | |
"mappings": { | |
"ht": { | |
"properties": { | |
"key": { | |
"type": "string", | |
"index_options": "offsets", | |
"boost": 1 | |
}, | |
"name": { | |
"type": "multi_field", | |
"path": "just_name", | |
"fields": { | |
"name": { | |
"type": "string", | |
"index_options": "offsets", | |
"boost": 10 | |
}, | |
"all": { | |
"type": "string", | |
"index_options": "offsets", | |
"boost": 10 | |
} | |
} | |
}, | |
"junk": { | |
"type": "multi_field", | |
"path": "just_name", | |
"fields": { | |
"junk": { | |
"type": "string", | |
"index_options": "offsets", | |
"boost": 0.1 | |
}, | |
"all": { | |
"type": "string", | |
"index_options": "offsets", | |
"boost": 0.1 | |
} | |
} | |
} | |
} | |
} | |
} | |
}' | |
curl -XPOST "http://localhost:9200/test/ht/" -d' | |
{"key":"drew", "name":"john", "junk":"doug"}' | |
curl -XPOST "http://localhost:9200/test/ht/" -d' | |
{"key":"john", "name":"alex", "junk":"john"}' | |
curl -XPOST "http://localhost:9200/test/ht/" -d' | |
{"key":"stanley", "name":"bob", "junk":"john"}' | |
curl -XPOST "http://localhost:9200/test/ht/" -d' | |
{"key":"ted", "name":"sean", "junk":"john"}' | |
curl -XPOST "http://localhost:9200/test/ht/" -d' | |
{"key":"jim", "name":"matt", "junk":"john"}' | |
curl -XPOST "http://localhost:9200/test/ht/_search/" -d' | |
{ | |
"query": { | |
"match": { | |
"_all": { | |
"query": "john" | |
} | |
} | |
} | |
}' | |
{ | |
"took": 1, | |
"timed_out": false, | |
"_shards": { | |
"total": 1, | |
"successful": 1, | |
"failed": 0 | |
}, | |
"hits": { | |
"total": 5, | |
"max_score": 2.89093, | |
"hits": [ | |
{ | |
"_index": "test", | |
"_type": "ht", | |
"_id": "gnLCXQrSQfWQ4E0fr9nqcQ", | |
"_score": 2.89093, | |
"_source": { | |
"key": "drew", | |
"name": "john", | |
"junk": "doug" | |
} | |
}, | |
{ | |
"_index": "test", | |
"_type": "ht", | |
"_id": "GojxlJ-fS5e3CTekBNFwYQ", | |
"_score": 0.040883925, | |
"_source": { | |
"key": "john", | |
"name": "alex", | |
"junk": "john" | |
} | |
}, | |
{ | |
"_index": "test", | |
"_type": "ht", | |
"_id": "43mXeR3uQDawmvSDUhpcuA", | |
"_score": 0.0289093, | |
"_source": { | |
"key": "stanley", | |
"name": "bob", | |
"junk": "john" | |
} | |
}, | |
{ | |
"_index": "test", | |
"_type": "ht", | |
"_id": "1jn46e6xRZaPkz4-AHCdPw", | |
"_score": 0.0289093, | |
"_source": { | |
"key": "ted", | |
"name": "sean", | |
"junk": "john" | |
} | |
}, | |
{ | |
"_index": "test", | |
"_type": "ht", | |
"_id": "n7_8dpx5SRaoEHFwNU9Org", | |
"_score": 0.0289093, | |
"_source": { | |
"key": "jim", | |
"name": "matt", | |
"junk": "john" | |
} | |
} | |
] | |
} | |
} | |
curl -XPOST "http://localhost:9200/test/ht/_search/" -d' | |
{ | |
"query": { | |
"match": { | |
"all": { | |
"query": "john" | |
} | |
} | |
} | |
}' | |
{ | |
"took": 1, | |
"timed_out": false, | |
"_shards": { | |
"total": 1, | |
"successful": 1, | |
"failed": 0 | |
}, | |
"hits": { | |
"total": 5, | |
"max_score": 0.51104903, | |
"hits": [ | |
{ | |
"_index": "test", | |
"_type": "ht", | |
"_id": "gnLCXQrSQfWQ4E0fr9nqcQ", | |
"_score": 0.51104903, | |
"_source": { | |
"key": "drew", | |
"name": "john", | |
"junk": "doug" | |
} | |
}, | |
{ | |
"_index": "test", | |
"_type": "ht", | |
"_id": "GojxlJ-fS5e3CTekBNFwYQ", | |
"_score": 0.51104903, | |
"_source": { | |
"key": "john", | |
"name": "alex", | |
"junk": "john" | |
} | |
}, | |
{ | |
"_index": "test", | |
"_type": "ht", | |
"_id": "43mXeR3uQDawmvSDUhpcuA", | |
"_score": 0.51104903, | |
"_source": { | |
"key": "stanley", | |
"name": "bob", | |
"junk": "john" | |
} | |
}, | |
{ | |
"_index": "test", | |
"_type": "ht", | |
"_id": "1jn46e6xRZaPkz4-AHCdPw", | |
"_score": 0.51104903, | |
"_source": { | |
"key": "ted", | |
"name": "sean", | |
"junk": "john" | |
} | |
}, | |
{ | |
"_index": "test", | |
"_type": "ht", | |
"_id": "n7_8dpx5SRaoEHFwNU9Org", | |
"_score": 0.51104903, | |
"_source": { | |
"key": "jim", | |
"name": "matt", | |
"junk": "john" | |
} | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment