Created
April 15, 2020 15:06
-
-
Save colepacak/583e8d2c0491387e602931a47844c1ce to your computer and use it in GitHub Desktop.
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
curl -X PUT "localhost:9200/suggestions?pretty" -H 'Content-Type: application/json' -d' | |
{ | |
"mappings": { | |
"properties": { | |
"id": { | |
"type": "integer" | |
}, | |
"type": { | |
"type": "keyword" | |
}, | |
"suggestion": { | |
"type": "keyword" | |
} | |
} | |
} | |
} | |
' | |
# all quiet on the western front | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 777, | |
"type": "snippet", | |
"suggestion": "all quiet on" | |
} | |
' | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 777, | |
"type": "snippet", | |
"suggestion": "quiet on the" | |
} | |
' | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 777, | |
"type": "snippet", | |
"suggestion": "on the western" | |
} | |
' | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 777, | |
"type": "snippet", | |
"suggestion": "the western front" | |
} | |
' | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 777, | |
"type": "snippet", | |
"suggestion": "western front" | |
} | |
' | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 777, | |
"type": "snippet", | |
"suggestion": "front" | |
} | |
' | |
# quiet games are no fun | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 666, | |
"type": "snippet", | |
"suggestion": "quiet games are" | |
} | |
' | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 666, | |
"type": "snippet", | |
"suggestion": "games are no" | |
} | |
' | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 666, | |
"type": "snippet", | |
"suggestion": "are no fun" | |
} | |
' | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 666, | |
"type": "snippet", | |
"suggestion": "no fun" | |
} | |
' | |
curl -X POST "localhost:9200/suggestions/_doc" -H 'Content-Type: application/json' -d' | |
{ | |
"id": 666, | |
"type": "snippet", | |
"suggestion": "fun" | |
} | |
' | |
curl http://localhost:9200/suggestions/_search?pretty -H "Content-Type: application/json" -d '{"query":{"match_all": {}}}' | |
curl -X GET "localhost:9200/suggestions/_search" -H 'Content-Type: application/json' -d' | |
{ | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"prefix": { | |
"suggestion": { | |
"value": "quiet" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment