Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curl -X PUT localhost:9200/test -s -H 'Content-Type: application/json' -d'{
- "settings" : {
- "number_of_shards" : 1
- },
- "mappings" : {
- "objects" : {
- "properties" : {
- "name" : {
- "fields": {
- "_raw":{
- "type":"keyword"
- }
- },
- "type" : "text"
- },
- "timestamp": {
- "type": "date"
- },
- "some":{
- "type":"integer"
- }
- }
- }
- }
- }'
- for i in $(seq 10010); do curl -X POST localhost:9200/test/objects -s -H 'Content-Type: application/json' -d@- <<EOF
- {
- "name":"John Doe #$i",
- "timestamp":"$(date --iso-8601=seconds)",
- "some": "$(( ( RANDOM % 1000 ) + 1 ))"
- }
- EOF
- done
- for i in $(seq 10); do echo $i;done
- curl localhost:9200/test/_mapping/objects?pretty=true
- curl localhost:9200/test/objects/_count?pretty=true
- curl localhost:9200/test/objects/qjgOqGgB_fSxOh8QCTQm
- curl localhost:9200/test/objects/_search?pretty=true -s -H 'Content-Type: application/json' -d'
- {
- "size" : 0,
- "aggs" : {
- "my_buckets": {
- "composite" : {
- "sources" : [
- { "duplicate": { "terms" : { "field": "name._raw" } } }
- ]
- },
- "aggs": {
- "filter": {
- "bucket_selector": {
- "buckets_path": {
- "doc_count": "_count"
- },
- "script": "params.doc_count > 2"
- }
- }
- }
- }
- }
- }'
- curl localhost:9200/test/objects/_search?pretty=true -s -H 'Content-Type: application/json' -d'
- {
- "size" : 0,
- "aggs" : {
- "my_buckets": {
- "composite" : {
- "sources" : [
- { "duplicate": { "terms" : { "field": "name._raw" } } }
- ],
- "after": { "duplicate": "John Doe #10" }
- },
- "aggs": {
- "filter": {
- "bucket_selector": {
- "buckets_path": {
- "doc_count": "_count"
- },
- "script": "params.doc_count > 2"
- }
- }
- }
- }
- }
- }'
- curl -X DELETE localhost:9200/test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement