You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kibana字段不可搜索:test_produit索引仅nom字段可搜索求解答

Why Only the nom Field Is Searchable in Your test_produit Index

Hey there! This is a super common issue with Elasticsearch, and it almost always ties back to how your index's mapping is set up or how you're querying the fields. Let's break down the most likely causes and how to diagnose them:

1. Only nom is mapped as a text type

Elasticsearch only supports full-text search on fields marked as text—this type gets analyzed (split into searchable tokens) to enable keyword matches. Other field types like keyword, integer, date, or boolean don’t support full-text search by default; you can only query them with exact matches or range filters.

For example, if your index mapping looks like this:

{
  "mappings": {
    "properties": {
      "nom": { "type": "text" },
      "description": { "type": "keyword" },
      "prix": { "type": "integer" }
    }
  }
}
  • nom will work with match or multi_match queries (full-text search)
  • description can only be found with exact term queries (case-sensitive, no partial matches)
  • prix requires numerical queries (like ranges or exact values)

To check your current mapping, run this command:

GET test_produit/_mapping

2. Dynamic mapping is disabled or misconfigured

If you turned off dynamic mapping (dynamic: false) in your index settings, any fields not explicitly defined in your mapping won’t be indexed at all. That means even if you send documents with other fields, Elasticsearch ignores them—so they can’t be searched.

Here’s what that misconfiguration might look like:

{
  "mappings": {
    "dynamic": false,
    "properties": {
      "nom": { "type": "text" }
    }
  }
}

In this case, only nom gets indexed; all other fields are discarded.

3. Fields are empty or weren’t properly indexed

Sometimes the issue isn’t the mapping—it’s the data. Double-check that your documents actually have valid values in the non-searchable fields. Run a search to fetch a sample document:

GET test_produit/_search

Or look up a specific document by ID:

GET test_produit/_doc/your-document-id

If the fields are null, empty strings, or formatted incorrectly (like a string that should be a number), Elasticsearch might not index them as expected.

4. You’re using the wrong query type

Even if a field is indexed, using the wrong query will fail to return results. For example:

  • Use match or match_phrase for text fields (full-text search)
  • Use term or terms for keyword, numerical, or boolean fields (exact matches)
  • Use range queries for dates or numbers

If you try to use a match query on a keyword field, it won’t work unless the query text exactly matches the field value (including case).


To fix this, start by checking your index mapping to confirm field types. If you need full-text search on other fields, update the mapping to set them as text (you’ll likely need to reindex your data if the index already exists).

内容的提问来源于stack exchange,提问作者tomak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 09:10:18