Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curl -X DELETE "http://localhost:9200/articles"
- curl -X PUT "http://localhost:9200/articles" -d '{
- "settings": {
- "index": {
- "number_of_shards": 1, "number_of_replicas": 0
- }
- }
- }'
- curl -X POST "http://localhost:9200/articles/article" -d '{ "id": 111, "owner": ["user_1"], "title": "One bad doc" }'
- curl -X POST "http://localhost:9200/articles/article" -d '{ "id": 222, "owner": ["user_2"], "title": "Two bad doc" }'
- curl -X POST "http://localhost:9200/articles/article" -d '{ "id": 333, "owner": ["user_3"], "title": "Three good doc" }'
- curl -X POST "http://localhost:9200/articles/article" -d '{ "id": 444, "owner": ["user_1"], "title": "Four good doc" }'
- curl -X POST "http://localhost:9200/articles/article" -d '{ "id": 555, "owner": ["user_2"], "title": "Five good doc" }'
- curl -X POST "http://localhost:9200/articles/article" -d '{ "id": 666, "owner": ["user_1"], "title": "Six good doc" }'
- curl -XPOST 'http://localhost:9200/articles/_refresh'
- curl -X POST "http://localhost:9200/articles/_search?pretty=true" -d '{
- "query": {
- "bool":{
- "must":[{ "query_string":{ "query":"doc", "default_operator":"AND" } }],
- "should":[{ "query_string":{ "query":"user_2", "default_operator":"AND", "boost":2000 } }]
- }
- },
- "facets": {
- "tags": { "terms": {"field": "owner", "size": 10} }
- }
- }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement