我试图建立这个查询一点点.我正在搜索的索引还有一个带有id的字段"entity".因此,一些记录将具有"实体":16,"实体"156等,具体取决于实体的ID.我需要以这样的方式扩展此查询:我可以传递一个数组或一些值列表,例如{:term => {:entity => [1,16,100]}}并获取具有的记录其中一个整数作为它们的实体值.到目前为止我没有运气,有人可以帮帮我吗?
{
"query" : {
"bool" : {
"must" : [
{
"term" : {"user_type" : "alpha"}
},
{
"term" :{"area" : "16"}
}
],
"must_not" : [],
"should" : []
}
},
"filter": {
"or" : [{
"and" : [
{ "term" : { "area" : "16" } },
{ "term" : { "date" : "05072013" } }
]
}, {
"and" : [
{ "term" : { "area" : "16" } },
{ "term" …Run Code Online (Sandbox Code Playgroud) 我试图在弹性搜索中进行查询,它将执行以下操作:我希望它检查具有(metropolitan_area为16 AND starts_at为05072013)或(metropolitan_id为16 AND starts_at"blank"的结果.
这是我当前的查询,但我觉得它需要以某种方式嵌套,我不确定如何做到这一点.
{
"query" : {
"bool" : {
"must" : [
{
"term" : {"user" : "a"}
},
{
"term" :{"metropolitan_area" : "16"}
}
],
"must_not" : [],
"should" : []
}
},
"filter" : {
"or" : {
"filters" : [
{
"term" : {"user":"519"}
},
{
"term" : {"user":"6"}
},
{
"term" : {"user":"5"}
},
{
"term" : {"user":"36"}
},
{
"term" : {"starts_at":"05072013"}
},
{
"term" : {"starts_at":"blank"}
}
]
}
} …Run Code Online (Sandbox Code Playgroud) 如果我有许多组件彼此嵌套:
ComponentA
|___ Component AA
|___ Component AB
|___ Component ABA
|___ Component ABAA
|___ Component AC
|___ Component AD
Run Code Online (Sandbox Code Playgroud)
我现在处于组件ABAA的上下文中,我如何获得组件AA或A的注入器?
我试图在amazon opsworks中运行rails控制台,我试过:
sudo rails console -e production
sudo rails console production
RAILS_ENV=production sudo rails console
RAILS_ENV=production RACK_ENV=production sudo rails console
Run Code Online (Sandbox Code Playgroud)
使用这些命令中的每一个,控制台都在开发环境中启动.在我选择的环境中启动此控制台需要做什么?
有人可以帮我解决这个问题吗?我收到一个错误:"没有为[或]注册查询"我是否构造错误?它应该过滤所有结果,其中区域是530并且开始是空白或区域是530并且开始是"06192013",然后基于该文件与其他过滤器一起提升.
{
"query": {
"custom_filters_score": {
"query": {
"bool": {
"must": [
{"field":{"sector":"sector1"}},
{"term":{"user_type":"ghost"}},
{"term":{"area":"530"}}
]
},
"filter":{
"or": [
{
"and": [
{"term":{"area":"530"}},
{"term":{"start":"06192013"}}
]
},
{
"and": [
{"term":{"area":"530"}},
{"term":{"start":"blank"}}
]
}
]
}
},
"filters": [
{"filter":{"term":{"relevance" :5726}},"boost":"1000"},
{"filter":{"term":{"relevance2":5726}},"boost":"100"}
],
"score_mode":"total"
}
}
}
Run Code Online (Sandbox Code Playgroud)