Skip to content

Instantly share code, notes, and snippets.

@dadoonet
Created May 7, 2013 07:32
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 dadoonet/5530856 to your computer and use it in GitHub Desktop.
Save dadoonet/5530856 to your computer and use it in GitHub Desktop.
more like this (mlt) query with exact text on small dataset
# Delete the index `testindex`
curl -XDELETE 'http://localhost:9200/testindex'
# Create the index `testindex`
curl -XPUT 'http://localhost:9200/testindex' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'
# Wait for yellow
curl -XGET 'http://localhost:9200/_cluster/health?wait_for_status=yellow'
# Index one sample doc
curl -XPUT http://localhost:9200/testindex/type/1 -d '{
"title": "In india we have to try hard to cop up with the living conditions"
}'
# Refresh docs
curl -XPOST 'http://localhost:9200/testindex/_refresh' ; echo
# mlt query
curl -XPOST 'http://localhost:9200/testindex/type/_search?pretty' -d '{
"query": {
"more_like_this" : {
"fields" : [ "title" ],
"like_text" : "In india we have to try hard to cop up with the living conditions",
"min_doc_freq" : 0,
"min_term_freq" : 0
}
}
}' ; echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment