Mongodb Elasticsearch嵌套查询
我是elasticsearch的新手,使用river插件成功设置并从我的mongodb集合导入记录集。首先,我想查询“desc”字段,但无法获得查询。。不确定问题是否由定义索引的方式引起。。有人能帮忙吗 弹性搜索中的示例记录集如下所示Mongodb Elasticsearch嵌套查询,mongodb,elasticsearch,Mongodb,elasticsearch,我是elasticsearch的新手,使用river插件成功设置并从我的mongodb集合导入记录集。首先,我想查询“desc”字段,但无法获得查询。。不确定问题是否由定义索引的方式引起。。有人能帮忙吗 弹性搜索中的示例记录集如下所示 { "took": 2, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": {
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 107209,
"max_score": 1,
"hits": [
{
"_index": "shiv",
"_type": "shiv",
"_id": "iG1eIzN7RGO7hFfxTlnLuA",
"_score": 1,
"_source": {
"_id": {
"$oid": "50901d7f485bf7bd1c000021"
},
"brand": "",
"category": {
"$ref": "categories",
"$id": {
"$oid": "4fbd2221758cb11d14000174"
}
},
"comments": [],
"count_comment": 0,
"count_fav": 2,
"count_hotness": 1.46,
"count_rekick": 0,
"count_share": 0,
"country": {
"$ref": "countries",
"$id": {
"$oid": "4fec98f7758cb18c6e0002c9"
}
},
"currency": "pound",
"desc": "A men's automatic watch, this Seamaster Bond model features a Co-Axial escapement and date function. Its blue dial is teamed with a stainless steel case and bracelet for a look that's sporty and refined.",
"gender": "male",
"ident": "omega-seamaster-diver-bond-men-s-automatic-watch---ernest-jones-1351622015",
"img_url": "http://s7ondemand4.scene7.com/is/image/Signet/5735793?$detail$",
"lifestyles": [
{
"$ref": "lifestyles",
"$id": {
"$oid": "508ff6ca485bf73112000060"
}
}
],
"location": "United Kingdom",
"owner": {
"$ref": "accounts",
"$id": {
"$oid": "50742fd8485bf74b7a00213f"
}
},
"price": 2400,
"store": "ernestjones.co.uk",
"tags": [
"ernest-jones",
"bond"
],
"timestamp_creation": 1351622015,
"timestamp_exp": 1356825600,
"timestamp_update": 1351622015,
"title": "Omega Seamaster Diver Bond men's automatic watch - Ernest Jones",
"url": "http%3A%2F%2Fwww.ernestjones.co.uk%2Fwebstore%2Fd%2F5735793%2Fomega%20seamaster%20diver%20bond%20men%27s%20automatic%20watch%2F%3Futm_source%3Dgooglebase%26utm_medium%3Dfeedmanager%26cm_mmc%3DFroogle-_-CKB-_-nurses_fobs-_-watches%26cm_mmca1%3Domega%26cm_mmca2%3Dmale%26cm_mmca3%3Dadult"
}
}
]
}
}
索引“shiv”的映射如下所示
{
"shiv": {
"properties": {
"$oid": {
"type": "string"
}
}
}
}
再次感谢有,您尝试过匹配查询吗
使用curl或您选择的rest客户端…http://[host]:9200/[index\u name]/[doc\u type]/\u search
{
"query" : {
"match" : {
"desc" : "some value you want to find in desc"
}
}
}
到目前为止,您尝试了哪些查询?谢谢mconlin。。我用索引中存在的有效文本尝试了该查询,但不知何故,它总是返回零命中率。这就是我得到的所有信息{code>{“take”:2,“timed_out”:false,{“shards”:{“total”:5,“successful”:5,“failed”:0},“hits”:{“total”:0,“max_score”:null,“hits”:[]}您的查询在可能不太复杂的字段上工作吗?你能搜索“性别”:“男性”吗?您正在搜索正确的大小写(上/下)。那些带有特殊字符的长描述可以用奇怪的方式进行标记/分析。我会先用一个简单的字段检查您的查询语法。我已经尝试了几乎所有带有大写/小写变体的字段,唯一有效的字段是ES_id。另外请注意,是否有一种简单的方法可以将数据重新索引到新索引(不同的映射/设置),而无需再次推送大文件?不确定映射是否导致问题,但不想花费数天时间再次推送文件..没有简单的方法重新索引,您可以推送几条记录来测试新的索引/映射,对吗?你能发布你正在尝试的查询吗?