Skip to content

Instantly share code, notes, and snippets.

@nomoa
Last active March 8, 2017 11:15
Show Gist options
  • Save nomoa/96506d97dc582e79e6ff5c5511a3d702 to your computer and use it in GitHub Desktop.
Save nomoa/96506d97dc582e79e6ff5c5511a3d702 to your computer and use it in GitHub Desktop.
match_query_oom
host=http://localhost:9200
query="a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a"
# curl -XDELETE $host/test_index &> /dev/null
# Create index
curl -s -XPUT "$host/test_index?pretty&wait_for_active_shards=1" -d @- <<EOF
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis": {
"filter": {
"3grams": {
"type": "shingle",
"max_shingle_size": 3,
"min_shingle_size": 3
},
"60_limit": {
"type": "limit",
"max_token_count": 60
}
},
"analyzer": {
"all3grams": {
"tokenizer": "standard",
"filter": [ "3grams" ]
},
"first60": {
"tokenizer": "standard",
"filter": [
"3grams",
"60_limit"
]
}
}
}
},
"mappings": {
"test": {
"properties": {
"shingle_field": {
"type": "text",
"analyzer": "all3grams",
"search_analyzer": "first60"
}
}
}
}
}
EOF
# Will fail on too many boolean clauses
curl -XGET $host/test_index/_search?pretty -d @- <<EOF
{ "query": { "match": { "shingle_field": "$query" } } }
EOF
# Will cause OOM with Xmx set to 512m
curl -XGET $host/test_index/_search?pretty -d @- <<EOF
{
"query": {
"match": {
"shingle_field": {
"query": "$query",
"analyzer": "all3grams"
}
}
}
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment