Skip to content

Instantly share code, notes, and snippets.

@omarqureshi
Created January 31, 2014 15:56
Show Gist options
  • Save omarqureshi/8734844 to your computer and use it in GitHub Desktop.
Save omarqureshi/8734844 to your computer and use it in GitHub Desktop.
curl XPUT -d '{"settings":{"analysis":{"filter":{"ngram":{"type":"nGram","min_gram":3,"max_gram":25}},"analyzer":{"ngram":{"tokenizer":"whitespace","filter":["lowercase","stop","ngram"],"type":"custom"},"ngram_search":{"tokenizer":"whitespace","filter":["lowercase","stop"],"type":"custom"},"analyzer_startswith":{"tokenizer":"keyword","filter":"lowercase"}}}},"mappings":{"document":{"properties":{"id":{"type":"integer","index":"not_analyzed","store":true},"email":{"type":"string","tokenizer":"uax_url_email"},"first_name":{"type":"string","index_analyzer":"ngram","search_analyzer":"ngram_search"},"last_name":{"type":"string","index_analyzer":"ngram","search_analyzer":"ngram_search"},"mobile":{"type":"string","index_analyzer":"analyzer_startswith","search_analyzer":"analyzer_startswith"},"nhs_number":{"type":"string","index_analyzer":"ngram","search_analyzer":"ngram_search"},"primary_account_id":{"type":"integer"}}}}}' http://localhost:9200/test_service_users
curl XPUT -d '{"first_name":"Ronald","last_name":"McDonald","email":"[email protected]","mobile":"7515567651","nhs_number":null,"primary_account_id":null}' http://localhost:9200/test_service_users/service_user/990?op_type=create
curl XPUT -d '{"first_name":"Ham","last_name":"Burgler","email":"[email protected]","mobile":"7515432322","nhs_number":null,"primary_account_id":null}' http://localhost:9200/test_service_users/service_user/991?op_type=create
curl XPOST -d '{"doc":{"first_name":"Ronald","last_name":"McDonald","email":"[email protected]","mobile":"07515567651","nhs_number":null,"primary_account_id":693}}' http://localhost:9200/test_service_users/service_user/990/_update
curl XPOST -d '{"doc":{"first_name":"Ham","last_name":"Burgler","email":"[email protected]","mobile":"07515432322","nhs_number":null,"primary_account_id":693}}' http://localhost:9200/test_service_users/service_user/991/_update
curl XPUT -d '{"first_name":"Evil","last_name":"Grimace","email":"[email protected]","mobile":"7878561234","nhs_number":null,"primary_account_id":null}' http://localhost:9200/test_service_users/service_user/992?op_type=create
curl XPOST -d '{"doc":{"first_name":"Evil","last_name":"Grimace","email":"[email protected]","mobile":"07878561234","nhs_number":null,"primary_account_id":694}}' http://localhost:9200/test_service_users/service_user/992/_update
curl XPOST http://localhost:9200/test_service_users/_refresh
curl XGET -d '{"query":{"filtered":{"query":{"bool":{"should":[{"match":{"_all":""}},{"match":{"mobile":{"query":"","type":"phrase_prefix"}}}]}}}}}' http://localhost:9200/test_service_users/_search
curl XGET -d '{"query":{"filtered":{"query":{"bool":{"should":[{"match":{"_all":""}},{"match":{"mobile":{"query":"","type":"phrase_prefix"}}}]}},"filter":{"term":{"primary_account_id":694}}}}}' http://localhost:9200/test_service_users/_search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment