Last active
August 29, 2015 14:02
-
-
Save julianhille/5203065480dc62bb6752 to your computer and use it in GitHub Desktop.
In this scriupt are two tests. For Es 0.90
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
export ES_HOST=http://localhost:9200/ | |
# delete & recreate index with defaults | |
curl -XDELETE $ES_HOST/test | |
curl -XPUT $ES_HOST/test | |
# configure the mapping of the bug type in the test index | |
curl -XPUT $ES_HOST/test/bug/_mapping -d' | |
{ | |
"bug": { | |
"properties": { | |
"field": { | |
"type": "object", | |
"index": "not_analyzed", | |
"omit_norms": true | |
} | |
} | |
} | |
} | |
' | |
# Index a single percolator fro a not added dynamic field | |
curl -X PUT $ES_HOST/_percolator/test/1 -d ' | |
{ | |
"query": { | |
"filtered": { | |
"filter": { | |
"terms": | |
{ | |
"field.1": [456] | |
} | |
}, | |
"query": {"match_all":{}} | |
} | |
}, | |
"type":"bug" | |
}' | |
# percolate a document which should hit. | |
curl -X GET $ES_HOST/test/bug/_percolate -d ' | |
{ | |
"doc" : {"field" : {"1": [123, 456, 789], "0": [123]}} | |
}' | |
# second tests | |
# delete & recreate index with defaults | |
curl -XDELETE $ES_HOST/test | |
curl -XPUT $ES_HOST/test | |
# configure the mapping of the bug type in the test index | |
curl -XPUT $ES_HOST/test/bug/_mapping -d' | |
{ | |
"bug": { | |
"properties": { | |
"field": { | |
"type": "object", | |
"index": "not_analyzed", | |
"omit_norms": true | |
} | |
} | |
} | |
} | |
' | |
# Index a single document | |
curl -X PUT $ES_HOST/test/bug/1 -d ' | |
{ | |
"field" : {"1": [123, 456, 789], "0": [123]} | |
}' | |
# create a percolator | |
curl -X PUT $ES_HOST/_percolator/test/1 -d ' | |
{ | |
"query": { | |
"filtered": { | |
"filter": { | |
"terms": | |
{ | |
"field.1": [456] | |
} | |
}, | |
"query": {"match_all":{}} | |
} | |
}, | |
"type":"bug" | |
}' | |
# percolate a document which should hit and does | |
curl -X GET $ES_HOST/test/bug/_percolate -d ' | |
{ | |
"doc" : {"field" : {"1": [123, 456, 789], "0": [123]}} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment