我们在单个节点上使用elasticsearch索引数据。我们在后台运行了一个线程,用于根据最近的变化更新索引。
现在我们使用弹性搜索API来运行搜索查询。
{
"from" : 0,
"size" : 20,
"timeout" : 0,
"query" : {
"filtered" : {
"query" : {
"query_string" : {
"query" : "Bug-157099*",
"default_field" : "_content",
"default_operator" : "and",
"allow_leading_wildcard" : true,
"analyze_wildcard" : true
}
},
"filter" : {
"fquery" : {
"query" : {
"query_string" : {
"query" : "pxObjClass:(\"ProjMgmt-Work-Project\")",
"default_field" : "_content",
"default_operator" : "and",
"allow_leading_wildcard" : true
}
},
"_cache" : false
}
}
}
},
"fields" : "*"
}
但是,搜索查询返回不一致的结果。在连续地重新运行查询时,有时得到0的结果,有时得到部分的结果,有时得到完整的结果。
我们在集群中面临这个问题,其中只有一个节点是索引节点。
你能告诉我们是什么导致了这个问题吗?
发布于 2014-10-30 05:33:12
该问题是由于查询中设置的超时造成的。在代码的某些部分,我们将超时设置为零。我们更正了代码,现在查询工作正常。
我在这里插入了正确的查询
{
"from" : 0,
"size" : 20,
"query" : {
"filtered" : {
"query" : {
"query_string" : {
"query" : "BUg-157099*",
"default_field" : "_content",
"default_operator" : "and",
"allow_leading_wildcard" : true,
"analyze_wildcard" : true
}
},
"filter" : {
"fquery" : {
"query" : {
"query_string" : {
"query" : "pxObjClass:(\"ProjMgmt-Work-Project\")",
"default_field" : "_content",
"default_operator" : "and",
"allow_leading_wildcard" : true
}
},
"_cache" : false
}
}
}
},
"fields" : "*"
}
https://stackoverflow.com/questions/26628229
复制相似问题