Created
November 12, 2015 09:22
-
-
Save PirosB3/8e93ca5236d395c3954d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Let's start by checking how many documents we have in the collection | |
GET /bank/account/_count | |
# A simple search. The word "Michael" must be fully conatiend somewhere in the specified field. | |
# A score is given to each document retrieved | |
GET /bank/account/_search | |
{ | |
"query": { | |
"match": { | |
"address": "Temple Court" | |
} | |
} | |
} | |
# We can use match_phrase if we want to be a bit more precise. This will only match document addresses that contain "Temple Court" | |
GET /bank/account/_search | |
{ | |
"query": { | |
"match_phrase": { | |
"address": "Temple Court" | |
} | |
} | |
} | |
# A simple search. The word "Michael" must be fully conatiend somewhere in the specified field. | |
# A score is given to each document retrieved | |
GET /bank/account/_search | |
{ | |
"query": { | |
"match": { | |
"address": "Temple Court" | |
} | |
} | |
} | |
# We can use match_phrase if we want to be a bit more precise. This will only match document addresses that contain "Temple Court" | |
GET /bank/account/_search | |
{ | |
"query": { | |
"multi_match" : { | |
"query": "temple", | |
"fields": [ "address", "lastname"] | |
} | |
} | |
} | |
# Never assume human imput! that's why we want to perform a fuzzy search at times | |
GET /bank/account/_search | |
{ | |
"query": { | |
"fuzzy": { | |
"address": { | |
"value": "tmple", | |
"fuzziness": 2 | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment