为什么我的ES6文本查询不返回任何匹配?

时间:2018-06-20 10:04:46

标签: elasticsearch

我已经创建了该索引:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:text="sainadh"
        android:layout_centerHorizontal="true"/>


</RelativeLayout>

接下来是映射:

PUT /twitter
{
  "settings": {
    "index": {
      "number_of_replicas": 2,
      "number_of_shards": 3
    }
  }
}

我插入了一个文档:

PUT /twitter/_mapping/_doc
{
  "properties": {
    "name": {
      "type": "text"
    },
    "user_id": {
      "type": "keyword"
    },
    "size": {
      "type": "integer"
    }
  }
}

现在,以下查询不起作用-它找到0个结果:

POST /twitter/_doc
{
  "name": "John",
  "user_id": "AD4G",
  "size": 100
}'

如果我查询例如POST /twitter/_search {"query": { "bool": { "must": { "term": { "name": "John" } } } } } ,它可以正常工作。

这是怎么了?

Elasticsearch 6.3

0 个答案:

没有答案
相关问题