dpblwmh5218 2019-06-26 14:26
浏览 498

PHP Elasticsearch:通配符查询将找不到任何结果

Im trying to use a wildcard for a specific column in my elasticsearch document. However, doing so, nothing happens. Elasticsearch doesn't find any results.

Source: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html

How my search query looks like:

array:3 [
  "index" => "certificates"
  "type" => "_doc"
  "body" => array:3 [
    "from" => 0
    "size" => 25
    "query" => array:1 [
      "wildcard" => array:1 [
        "product_name" => array:1 [
          "value" => "Fra*"
        ]
      ]
    ]
  ]
]

I don't see any difference to what the elasticsearch documentation recommends me.

PHP Version: 7.1.3

Elasticsearch version: 6.7.0

Response from elasticsearch when searching:

{
    "took": 2,
    "timed_out": false,
    "_shards": {
        "total": 5,
        "successful": 5,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": 0,
        "max_score": null,
        "hits": []
    }
}

Sample data inside of a document:

enter image description here

  • 写回答

1条回答 默认 最新

  • duanhuiqing9528 2019-06-27 09:15
    关注

    Didn't solve it with wildcards--still not working--however, it works with query_string

                'query_string' => [
                    'query' => 'product_name:' . $request->product_name . '*',
                    'default_operator' => 'AND'
                ]
    
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?