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 一道python难题2
  • ¥15 一道python难题
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备