douzhi4991 2017-02-24 14:36
浏览 184

parsing_exception:没有为[filtered]注册[query]

I am trying to find all the results which is not contain a field 'open_location'. I am using the below code. But it gives me the error for print result. The error is, parsing_exception: no [query] registered for [filtered]

I have seen this question for my solution, Best way to check if a field exist in an Elasticsearch document But

Please help me...

$index_name=$db_name.'_temp_traking';

    $para= [
        'index' => $index_name,
        'type' => $index_name,
        'body' => [
            'query' => [
                'filtered' => [
                    'filter' => [
                        'bool' => [
                            'must_not' => [
                                'missing' => [
                                    'field' => 'open_location'
                                ]
                            ]
                        ]
                    ]
                ]
            ]
        ]
    ];
    $response = $client->search($para);
  • 写回答

1条回答 默认 最新

  • douxiong3245 2017-02-24 14:47
    关注

    The filtered query is deprecated and removed in Elastic 5, which I guess is what you are using. Also, you say you're looking for docs that do NOT contain the field, but your code says it 'must not' be 'missing'.

    If you need the field not to exist, try this:

     "query": {
            "bool": {
                "must_not": {
                    "exists": {
                        "field": "open_location"
                    }
                }
            }
        }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数