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'
                ]
    
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度