elasticsearch匹配查询不出结果

1、elasticsearch匹配查询不出结果
2、

public  function elasticsearch(){
   $keyword = $_POST["keyword"];
   $elasticsearch = new \Think\ElasticsearchService ('120.27.130.110','9200','my_tmgc','menu');
    $searchParams = array(
        'query' => array(
            'match' => array(
                'article_content' => $keyword,
            )
        ),
    );
    $result= $elasticsearch->search( $searchParams );
    var_dump($result);
}

3、结果:

在输入框输入“1222”,结果是:

string '{"took":5,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}' (length=122)

4、elasticsearch的数据

{ "took": 4, "timed_out": false, "_shards": {

"total": 5,
"successful": 5,
"failed": 0   },   "hits": {
"total": 2,
"max_score": 1,
"hits": [
  {
    "_index": "my_tmgc",
    "_type": "menu",
    "_id": "$z",
    "_score": 1,
    "_source": {
      "article_id": "111",
      "article_title": "2222",
      "article_content": "22222222222222222222222222222",
      "article_cteatetime": "2017-05-04 10:02:05"
    }
  },
  {
    "_index": "my_tmgc",
    "_type": "menu",
    "_id": "AVvRM9nn77sSD8cdbBLz",
    "_score": 1,
    "_source": {
      "article_id": "113",
      "article_title": "122222",
      "article_content": "1222222222222222222222222222222",
      "article_cteatetime": "2017-05-04 10:04:48"
    }
  }
]   } }

4、尝试输入article_content字段的完整内容

"1222222222222222222222222222222"

,可以找到结果,但是输入部分内容”1222“,就是上面的结果,找不到。

阅读 4.3k
1 个回答
新手上路,请多包涵

我和你遇到的问题一样,请问你有解决办法了吗?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题