Elasticsearch查询不返回当前数据的记录

时间:2014-10-07 09:25:17

标签: elasticsearch

我们有大约100万条记录的小型弹性搜索指数。 elasticsearch中的记录如下所示。

{
  _index: gobzersearchindex
  _type: searchField
  _id: V-BzuHMgSui1l-vxlqTeTg
  _score: 3.614574
  _source: {
    gobzId: 198992
    productAttributes: [
      {
        name: untag_words
        value: yebhi59413 puma bikini
      }
      {
        name: brand
        value: Puma
      }
    ]
    imageOptimized: 0
    multiColor: 0
  }
}

当我尝试查询索引时,我发现了一些不寻常的行为。我正在尝试以下查询。

{
  "bool" : {
    "must" : {
      "match" : {
        "productAttributes.value" : {
          "query" : "adidas",
          "type" : "boolean"
        }
      }
    }
  }
}

当我搜索查询字符串adidas时,我没有得到上述查询的结果,但是当我使用pumabenetton和其他品牌等查询字符串时,相同的查询会返回结果。我无法弄清楚我做错了什么。

编辑: 以下映射用于创建索引

PUT /gobzersearchindex/
{
  "settings": {
    "analysis": {
      "filter": {
        "test_filter_stopwords_en": {
          "type": "stop",
          "stopwords_path": "stop_en.txt"
        },
        "test_filter_snowball_en": {
          "type": "snowball",
          "language": "English"
        },
        "test_filter_synonyms_en": {
          "type": "synonym",
          "synonyms_path": "synonyms_en.txt",
          "ignore_case": true,
          "expand": true
        },
        "test_filter_ngram": {
          "type": "edgeNGram",
          "min_gram": 2,
          "max_gram": 30
        }
      },
      "analyzer": {
        "test_analyzer": {
          "type": "custom",
          "tokenizer": "whitespace",
          "filter": [
            "lowercase",
            "test_filter_stopwords_en",
            "test_filter_synonyms_en",
            "test_filter_snowball_en"
          ],
          "char_filter": "html_strip"
        }
      }
    }
  },
  "mappings": {
    "searchField": {
      "properties": {
        "itemSearchableField": {
          "index": "analyzed",
          "type": "string",
          "store": "yes",
          "include_in_all": false,
          "analyzer": "test_analyzer"
        },
        "productAttributes.value": {
          "index": "analyzed",
          "type": "string",
          "store": "yes",
          "include_in_all": false,
          "analyzer": "test_analyzer"
        }
      }
    }
  }
}

0 个答案:

没有答案