Created
July 21, 2011 12:38
-
-
Save imotov/1097105 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 -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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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