ElasticSearch在搜索中返回文档,但不在GET中 [英] ElasticSearch returns document in search but not in GET

查看:121
本文介绍了ElasticSearch在搜索中返回文档,但不在GET中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在搜索索引中的文档,然后尝试通过 _id 获取其中的一些。尽管收到一组结果,但一些文档无法通过简单的获取来检索。更糟糕的是,我可以使用URI搜索获取相同的文档,其中?_ id:< id>



例如,运行一个简单的GET

  curl -XGET'http:// localhost:9200 / keepbusy_process__issuer_application / KeepBusy__Activities__Activity / neHSKSBCSv- Oyayn3IFcew'

给我结果:



<$
_index:keepbusy_process__issuer_application,
_type:KeepBusy__Activities__Activity,
_id:neHSKSBCSv-OyAYn3IFcew,
存在:false
}

但是如果我做同样的搜索_id:

  curl -XGET'http:// localhost:9200 / keepbusy_process__issuer_application / KeepBusy__Activities__Activity / _search?q = _id:neHSKSBCSv- Oyayn3IFcew'

我得到预期的结果:

  {
take:2,
timed_out:false,
_shards:{
total:5 ,
成功:5,
失败:0
},
hits:{
total:1,
max_score
hits:[
{
_index:keepbusy_process__issuer_application,
_type:KeepBusy__Activities__Activity,
_id:neHSKSBCSv-OyAYn3IFcew
_score:1.0,
_source:{
template_uid:KeepBusy__Activities__Activity.create application,
name:create application,
updated_at:2014-01-08T10:02:33-05:00,
updated_at_ms:1389193353975
}
}
]
}
}

我是通过担架ruby API索引文档,索引我正在刷新。我的本地设置是 2个节点。我正在运行 v0.90.9



日志中没有什么明显的,为什么这应该失败。我已经重新启动了集群,一切似乎正确启动,但结果是一样的。



有没有什么我会丢失或某种方式我可以进一步诊断这个问题?

解决方案

这个问题通常发生在文档用非默认路由索引(显式设置或从父级ID中扣除父/子文件的情况)。如果是这种情况,请尝试指定正确的路由在你得到请求。


I'm doing a search of documents in my index, then subsequently trying to get some of them by _id. Despite receiving a set of results, some of the documents can not be retrieved with a simple get. Worse still, I CAN get the same document with a URI search where ?_id:<the id>

Just for example, running a simple GET

curl -XGET 'http://localhost:9200/keepbusy_process__issuer_application/KeepBusy__Activities__Activity/neHSKSBCSv-OyAYn3IFcew'

Gives me the result:

{
  "_index" : "keepbusy_process__issuer_application",
  "_type" : "KeepBusy__Activities__Activity",
  "_id" : "neHSKSBCSv-OyAYn3IFcew",
  "exists" : false
}

But if I do a search with same _id:

curl -XGET 'http://localhost:9200/keepbusy_process__issuer_application/KeepBusy__Activities__Activity/_search?q=_id:neHSKSBCSv-OyAYn3IFcew'

I get the expected result:

{
  "took": 2,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 1.0,
    "hits": [
      {
        "_index": "keepbusy_process__issuer_application",
        "_type": "KeepBusy__Activities__Activity",
        "_id": "neHSKSBCSv-OyAYn3IFcew",
        "_score": 1.0,
        "_source": {
          "template_uid": "KeepBusy__Activities__Activity.create application",
          "name": "create application",
          "updated_at": "2014-01-08T10:02:33-05:00",
          "updated_at_ms": 1389193353975
        }
      }
    ]
  }
}

I'm indexing documents through the stretcher ruby API, and immediately after indexing I'm doing a refresh. My local setup is 2 nodes. I'm running v0.90.9

There is nothing obvious in the logs why this should fail. I've restarted the cluster and everything appears to start correctly, but the result is the same.

Is there something I'm missing or some way I can further diagnose this issue?

解决方案

This issue typically occurs when documents are indexed with non-default routing (either explicitly set or deducted from parent's id in case of parent/child documents). If this is the case, try specifying correct routing in you get request.

这篇关于ElasticSearch在搜索中返回文档,但不在GET中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆