Last active
June 29, 2016 21:06
-
-
Save jbaiera/4098dc0fa9fb1d556bc0dc74214e9bf1 to your computer and use it in GitHub Desktop.
Searching for "google" in Elasticsearch
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
curl -XPUT localhost:9200/ftfy -d '{ | |
"mappings": { | |
"document":{ | |
"properties":{ | |
"content":{ | |
"type":"string", | |
"analyzer":"simple" | |
} | |
} | |
} | |
} | |
}' | |
#> {"acknowledged":true} | |
curl -XPUT localhost:9200/ftfy/document/1 -d '{"content": "http://google.com"}' | |
#> {"_index":"ftfy","_type":"document","_id":"1","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true} | |
curl -XPOST localhost:9200/ftfy/document/_search?pretty -d '{"query":{"match":{"content":"google"}}}' | |
#> { | |
#> "took" : 1, | |
#> "timed_out" : false, | |
#> "_shards" : { | |
#> "total" : 5, | |
#> "successful" : 5, | |
#> "failed" : 0 | |
#> }, | |
#> "hits" : { | |
#> "total" : 1, | |
#> "max_score" : 0.15342641, | |
#> "hits" : [ { | |
#> "_index" : "ftfy", | |
#> "_type" : "document", | |
#> "_id" : "1", | |
#> "_score" : 0.15342641, | |
#> "_source" : { | |
#> "content" : "http://google.com" | |
#> } | |
#> } ] | |
#> } | |
#>} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment