Last active
November 6, 2015 09:44
-
-
Save EgorLakomkin/b72d68410e0682243cea 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/test_es_index" && echo | |
curl -XPUT "http://localhost:9200/test_es_index" -d ' { | |
"settings" : { | |
"number_of_shards": 1, | |
"number_of_replicas": 0, | |
"analysis" : { | |
"filter" : { | |
"stop_filter" : { | |
"type" : "stop", | |
"stopwords" : [ "a", "that", "those" ] | |
} | |
}, | |
"analyzer" : { | |
"content_analyzer" : { | |
"tokenizer" : "standard", | |
"filter" : ["standard", "lowercase", "stop_filter"] | |
} | |
} | |
} | |
}, | |
"mappings" : { | |
"doc" : { | |
"properties":{ | |
"content" : { "type" : "multi_field", | |
"fields":{ | |
"original" : {"type" : "string", "analyzer" : "content_analyzer"} | |
} | |
} | |
} | |
} | |
} | |
}' && echo | |
curl -XPOST 'http://localhost:9200/test_es_index/doc' -d '{ | |
"content" : "three four world that awesome those hello five" | |
}' && echo | |
curl -XPOST "http://localhost:9200/test_es_index/_refresh" && echo | |
curl -s "http://localhost:9200/test_es_index/_search?pretty=true" -d ' | |
{"query": { | |
"query_string" : { | |
"default_field" : "content.original", | |
"query" : "hello world", | |
"default_operator" : "and", | |
"enable_position_increments": "false", | |
"phrase_slop" : 0 | |
} | |
}, | |
"highlight" : {"require_field_match" : "true", "fields" : {"content.original" : {} } } | |
}' && echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment