Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jblievremont/8331460 to your computer and use it in GitHub Desktop.
The attached files describe HTTP exchanges made with the REST API of an ElasticSearch 0.90.6 node, to describe the problem encountered in this thread: https://groups.google.com/forum/#!topic/elasticsearch/pfQ1wiTeObk The node has one index named 'rules' with 2 types ('rule' and 'active_rule'). The Java code responsible for the calls can be found…
>>>
POST /rules/active_rule/_search?search_type=scan&scroll=1m
{
"size": 25,
"fields": [
"id"
],
"filter": {
"bool": {
"must": [
{ "term": {
"profileId": 1
} },
{ "has_parent": {
"type": "rule",
"filter": {
"bool": {
"must_not": [
{"term": {
"status": "REMOVED"
} }
]
}
}
} }
]
}
}
}
<<<
{
"_scroll_id": "c2NhbjsxOzg6MTsxO3RvdGFsX2hpdHM6NDk2Ow==",
"took": 3,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 496,
"max_score": 0,
"hits": []
}
}
>>>
GET /_search/scroll/c2NhbjsxOzk6MTsxO3RvdGFsX2hpdHM6NDk2Ow==?scroll=1m
<<<
{
"_scroll_id": "c2NhbjswOzE7dG90YWxfaGl0czo0OTY7",
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 496,
"max_score": 0,
"hits": []
}
}
### hits is empty
>>>
POST /rules/active_rule/_search?search_type=scan&scroll=1m
{
"size": 25,
"fields": [
"id"
],
"query": {
"bool": {
"must": [
{ "term": {
"profileId": 1
} },
{ "has_parent": {
"type": "rule",
"query": {
"bool": {
"must_not": [
{"term": {
"status": "REMOVED"
} }
]
}
}
} }
]
}
}
}
<<<
{
"_scroll_id": "c2NhbjsxOzEwOjE7MTt0b3RhbF9oaXRzOjQ5Njs=",
"took": 25,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 496,
"max_score": 0,
"hits": []
}
}
>>>
GET /_search/scroll/c2NhbjsxOzEwOjE7MTt0b3RhbF9oaXRzOjQ5Njs=?scroll=1m
<<<
{
"_scroll_id": "c2NhbjsxOzEwOjE7MTt0b3RhbF9oaXRzOjQ5Njs=",
"took": 4,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 496,
"max_score": 0,
"hits": [
{
"_index": "rules",
"_type": "active_rule",
"_id": "25",
"_score": 0,
"fields": {
"id": 25
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "26",
"_score": 0,
"fields": {
"id": 26
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "27",
"_score": 0,
"fields": {
"id": 27
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "28",
"_score": 0,
"fields": {
"id": 28
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "29",
"_score": 0,
"fields": {
"id": 29
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "30",
"_score": 0,
"fields": {
"id": 30
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "31",
"_score": 0,
"fields": {
"id": 31
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "32",
"_score": 0,
"fields": {
"id": 32
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "33",
"_score": 0,
"fields": {
"id": 33
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "34",
"_score": 0,
"fields": {
"id": 34
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "35",
"_score": 0,
"fields": {
"id": 35
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "36",
"_score": 0,
"fields": {
"id": 36
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "37",
"_score": 0,
"fields": {
"id": 37
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "38",
"_score": 0,
"fields": {
"id": 38
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "39",
"_score": 0,
"fields": {
"id": 39
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "40",
"_score": 0,
"fields": {
"id": 40
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "41",
"_score": 0,
"fields": {
"id": 41
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "42",
"_score": 0,
"fields": {
"id": 42
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "43",
"_score": 0,
"fields": {
"id": 43
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "44",
"_score": 0,
"fields": {
"id": 44
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "45",
"_score": 0,
"fields": {
"id": 45
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "46",
"_score": 0,
"fields": {
"id": 46
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "47",
"_score": 0,
"fields": {
"id": 47
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "48",
"_score": 0,
"fields": {
"id": 48
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "49",
"_score": 0,
"fields": {
"id": 49
}
}
]
}
}
### Etc.
>>>
POST /rules/active_rule/_search?search_type=scan&scroll=1m
{
"size": 25,
"fields": [
"id"
],
"filter": {
"bool": {
"must": [
{ "term": {
"profileId": 1
} }
]
}
}
}
<<<
{
"_scroll_id": "c2NhbjsxOzc6MTsxO3RvdGFsX2hpdHM6NDk2Ow==",
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 496,
"max_score": 0,
"hits": []
}
}
>>>
GET /_search/scroll/c2NhbjsxOzc6MTsxO3RvdGFsX2hpdHM6NDk2Ow==?scroll=1m
<<<
{
"_scroll_id": "c2NhbjsxOzc6MTsxO3RvdGFsX2hpdHM6NDk2Ow==",
"took": 3,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 496,
"max_score": 0,
"hits": [
{
"_index": "rules",
"_type": "active_rule",
"_id": "25",
"_score": 0,
"fields": {
"id": 25
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "26",
"_score": 0,
"fields": {
"id": 26
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "27",
"_score": 0,
"fields": {
"id": 27
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "28",
"_score": 0,
"fields": {
"id": 28
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "29",
"_score": 0,
"fields": {
"id": 29
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "30",
"_score": 0,
"fields": {
"id": 30
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "31",
"_score": 0,
"fields": {
"id": 31
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "32",
"_score": 0,
"fields": {
"id": 32
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "33",
"_score": 0,
"fields": {
"id": 33
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "34",
"_score": 0,
"fields": {
"id": 34
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "35",
"_score": 0,
"fields": {
"id": 35
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "36",
"_score": 0,
"fields": {
"id": 36
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "37",
"_score": 0,
"fields": {
"id": 37
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "38",
"_score": 0,
"fields": {
"id": 38
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "39",
"_score": 0,
"fields": {
"id": 39
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "40",
"_score": 0,
"fields": {
"id": 40
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "41",
"_score": 0,
"fields": {
"id": 41
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "42",
"_score": 0,
"fields": {
"id": 42
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "43",
"_score": 0,
"fields": {
"id": 43
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "44",
"_score": 0,
"fields": {
"id": 44
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "45",
"_score": 0,
"fields": {
"id": 45
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "46",
"_score": 0,
"fields": {
"id": 46
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "47",
"_score": 0,
"fields": {
"id": 47
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "48",
"_score": 0,
"fields": {
"id": 48
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "49",
"_score": 0,
"fields": {
"id": 49
}
}
]
}
}
>>>
GET /_search/scroll/c2NhbjsxOzc6MTsxO3RvdGFsX2hpdHM6NDk2Ow==?scroll=1m
<<<
{
"_scroll_id": "c2NhbjsxOzc6MTsxO3RvdGFsX2hpdHM6NDk2Ow==",
"took": 3,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 496,
"max_score": 0,
"hits": [
{
"_index": "rules",
"_type": "active_rule",
"_id": "50",
"_score": 0,
"fields": {
"id": 50
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "51",
"_score": 0,
"fields": {
"id": 51
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "52",
"_score": 0,
"fields": {
"id": 52
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "53",
"_score": 0,
"fields": {
"id": 53
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "54",
"_score": 0,
"fields": {
"id": 54
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "55",
"_score": 0,
"fields": {
"id": 55
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "56",
"_score": 0,
"fields": {
"id": 56
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "57",
"_score": 0,
"fields": {
"id": 57
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "58",
"_score": 0,
"fields": {
"id": 58
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "59",
"_score": 0,
"fields": {
"id": 59
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "60",
"_score": 0,
"fields": {
"id": 60
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "61",
"_score": 0,
"fields": {
"id": 61
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "62",
"_score": 0,
"fields": {
"id": 62
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "63",
"_score": 0,
"fields": {
"id": 63
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "64",
"_score": 0,
"fields": {
"id": 64
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "65",
"_score": 0,
"fields": {
"id": 65
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "66",
"_score": 0,
"fields": {
"id": 66
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "67",
"_score": 0,
"fields": {
"id": 67
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "68",
"_score": 0,
"fields": {
"id": 68
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "69",
"_score": 0,
"fields": {
"id": 69
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "70",
"_score": 0,
"fields": {
"id": 70
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "71",
"_score": 0,
"fields": {
"id": 71
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "72",
"_score": 0,
"fields": {
"id": 72
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "73",
"_score": 0,
"fields": {
"id": 73
}
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "74",
"_score": 0,
"fields": {
"id": 74
}
}
]
}
}
### Etc.
>>>
POST /rules/active_rule/_search
{
"size": 25,
"fields": [
"_id"
],
"filter": {
"bool": {
"must": [
{ "term": {
"profileId": 1
} },
{ "has_parent": {
"type": "rule",
"filter": {
"bool": {
"must_not": [
{"term": {
"status": "REMOVED"
} }
]
}
}
} }
]
}
}
}
<<<
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 496,
"max_score": 1,
"hits": [
{
"_index": "rules",
"_type": "active_rule",
"_id": "25",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "26",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "27",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "28",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "29",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "30",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "31",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "32",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "33",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "34",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "35",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "36",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "37",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "38",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "39",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "40",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "41",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "42",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "43",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "44",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "45",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "46",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "47",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "48",
"_score": 1
},
{
"_index": "rules",
"_type": "active_rule",
"_id": "49",
"_score": 1
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment