Created
May 7, 2013 07:32
-
-
Save dadoonet/5530856 to your computer and use it in GitHub Desktop.
more like this (mlt) query with exact text on small dataset
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
# 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