Skip to content

Instantly share code, notes, and snippets.

@imotov
Created July 21, 2011 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imotov/1097105 to your computer and use it in GitHub Desktop.
Save imotov/1097105 to your computer and use it in GitHub Desktop.
curl -XDELETE http://localhost:9200/stackoverflow
curl -XPUT http://localhost:9200/stackoverflow
curl -XPUT http://localhost:9200/stackoverflow/location/_mapping -d '{
"location" : {
"properties": {
"name": { "type": "string", "boost": 2.0, "analyzer": "snowball" },
"description": { "type": "string", "analyzer": "snowball" }
}
}
}'
curl -XPUT "http://localhost:9200/stackoverflow/location/1?refresh=true" -d '{
"name": "Savage, Minnesota",
"description": "Suburban city 15 miles (24 km) south-southwest of downtown Minneapolis in Scott County in the U.S. state of Minnesota"
}'
echo
curl -XPUT "http://localhost:9200/stackoverflow/location/2?refresh=true" -d '{
"name": "Norco, California",
"description": "Norco is also the home of the Norco Animal Rescue Team (NART). NART was founded after the October 2003 wildfires that savaged San Bernardino County and San Diego County."
}'
echo
curl -XPUT "http://localhost:9200/stackoverflow/location/3?refresh=true" -d '{
"name": "Concord, Massachusetts",
"description": "A town in Middlesex County, Massachusetts, in the United States."
}'
echo
curl "http://localhost:9200/stackoverflow/_search?pretty=true" -d '{
"fields" : ["name", "description"],
"query" : {
"bool" : {
"should" : [
{"text" : {"name" : "savage"}},
{"text" : {"description" : "savage"}}
]
},
"from" : 0,
"size" : 500
}
}'
echo
@ramrajvasavi
Copy link

Here we write this one is correct or not i don't know,but i have one question If my document has one filed,it some time take String and other time take Object.When it comes to elasticsearch It is giving error,then how to solve this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment