确实尝试了弹性搜索文档和谷歌的一些示例,但没有任何帮助解决..
只是我拥有的示例数据只是几篇博客文章。我正在尝试查看所有带有电子邮件地址的帖子。当我使用时,"email":"someone"
我看到所有匹配的帖子someone
,但是当我更改为使用时,someone@gmail.com
什么都没有出现!
"hits": [
{
"_index": "blog",
"_type": "post",
"_id": "2",
"_score": 1,
"_source": {
"user": "sreenath",
"email": "someone@gmail.com",
"postDate": "2011-12-12",
"body": "Trying to figure out this",
"title": "Elastic search testing"
}
}
]
当我使用 Get 查询时,如下所示,我看到所有帖子匹配someone@anything.com
。但我想把它
{ "term" : { "email" : "someone" }}
改成{ "term" : { "email" : "someone@gmail.com" }}
GET blog/post/_search
{
"query" : {
"filtered" : {
"filter" : {
"and" : [
{ "term" :
{ "email" : "someone" }
}
]
}
}
}
}
我为以下内容做了 curl -XPUT,但没有帮助
curl -XPUT localhost:9200/test/ -d '
{
"settings" : {
"analysis" : {
"filter" : {
"email" : {
"type" : "pattern_capture",
"preserve_original" : 1,
"patterns" : [
"([^@]+)",
"(\\p{L}+)",
"(\\d+)",
"@(.+)"
]
}
},
"analyzer" : {
"email" : {
"tokenizer" : "uax_url_email",
"filter" : [ "email", "lowercase", "unique" ]
}
}
}
}
}
'