Created
February 20, 2012 23:19
-
-
Save dadoonet/1872218 to your computer and use it in GitHub Desktop.
disabling source curl recreation
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
# Delete the index | |
curl -XDELETE http://localhost:9200/twitter | |
# Create the index | |
curl -XPUT http://localhost:9200/twitter | |
# Create the mapping using only fields | |
curl -XPOST http://localhost:9200/twitter/tweet/_mapping -d '{ | |
"tweet" : { | |
"_source" : {"enabled" : false}, | |
"properties" : { | |
"user" : {"type" : "string", "store" : "yes"}, | |
"message" : {"type" : "string", "store" : "yes"} | |
} | |
} | |
}' | |
# Create the mapping using source | |
curl -XPOST http://localhost:9200/twitter/othertweet/_mapping -d '{ | |
"othertweet" : { | |
"properties" : { | |
"user" : {"type" : "string"}, | |
"message" : {"type" : "string"} | |
} | |
} | |
}' | |
# Indexing with fields | |
curl -XPUT http://localhost:9200/twitter/tweet/1 -d '{ | |
"user" : "dadoonet field", | |
"message" : "Elasticsearch rocks field" | |
}' | |
# Indexing with source | |
curl -XPUT http://localhost:9200/twitter/othertweet/1 -d '{ | |
"user" : "dadoonet source", | |
"message" : "Elasticsearch rocks source" | |
}' | |
# Searching for all | |
curl -XPOST http://localhost:9200/_search?pretty=true -d '{ | |
"query" : { | |
"match_all" : { } | |
} | |
}' | |
# Searching for specific fields | |
curl -XPOST http://localhost:9200/_search?pretty=true -d '{ | |
"fields" : ["user", "message"], | |
"query" : { | |
"match_all" : { } | |
} | |
}' | |
# Searching for all fields (_source is not in *) | |
curl -XPOST http://localhost:9200/_search?pretty=true -d '{ | |
"fields" : ["*"], | |
"query" : { | |
"match_all" : { } | |
} | |
}' | |
# _source works with 0.17.10 but not with 0.19.0.RC2 | |
curl -XPOST http://localhost:9200/_search?pretty=true -d '{ | |
"fields" : ["_source"], | |
"query" : { | |
"match_all" : { } | |
} | |
}' | |
# _source doesn't appear even with 0.17.10 nor 0.19.0.RC2 | |
curl -XPOST http://localhost:9200/_search?pretty=true -d '{ | |
"fields" : ["*", "_source"], | |
"query" : { | |
"match_all" : { } | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment