Created
January 28, 2014 17:55
-
-
Save clintongormley/8672716 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 -XPUT "http://localhost:9200/test " -d' | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"prefix": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ | |
"lowercase", | |
"edge" | |
] | |
}, | |
"multi_end": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ | |
"lowercase", | |
"multi_end" | |
] | |
} | |
}, | |
"filter": { | |
"multi_end": { | |
"type": "pattern_capture", | |
"patterns": [ | |
"^(.+?).$", | |
"^(.+?)..$", | |
"^(.+?)...$", | |
"^(.+?)...$" | |
] | |
}, | |
"edge": { | |
"type": "edge_ngram", | |
"min_gram": 1, | |
"max_gram": 20, | |
"token_chars": [ | |
"letter", | |
"digit" | |
] | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"foo": { | |
"properties": { | |
"title": { | |
"type": "multi_field", | |
"fields": { | |
"title": { | |
"type": "string" | |
}, | |
"prefix": { | |
"type": "string", | |
"index_analyzer": "prefix", | |
"search_analyzer": "multi_end" | |
} | |
} | |
} | |
} | |
} | |
} | |
}' | |
curl -XPUT "http://localhost:9200/test/foo/1" -d' | |
{ | |
"title": "The quick brown foxes jumped over the lazy dogs" | |
}' | |
curl -XPOST "http://localhost:9200/test/foo/_search" -d' | |
{ | |
"query": { | |
"match_phrase": { | |
"title.prefix": { | |
"query": "quick brown fox jumps" | |
} | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment