Kibana data migration

When doing DSL aggregation operation, the data cannot be queried. Check the mapping and find that the field is set not to be indexed and does not participate in aggregation.
Insert image description here
Check the mapping.

"brandName": {
    
     
	"type": "keyword", 
	"index": false, 
	"doc_values": false
}

index:
Default is true. If it is false, it means that the field will not be indexed, but it will be included in the search results, but the field itself cannot
be used as a search condition.
doc_values:
Default is true, set to false, which means that sorting, aggregation and script operations cannot be performed, which saves disk space.
You can also set doc_values ​​to true and index to false so that the field cannot be searched but can be used for sorting, aggregation
and script operations:

Modify mapping without deleting data and use data migration

  1. Find out the mapping GET product/_mapping
  2. To create a new mapping,
    you need to delete the product layer.
    Insert image description here
PUT gulimall_product
{
    
    
  "mappings": {
    
    
    "properties": {
    
    
      "attrs": {
    
    
        "type": "nested",
        "properties": {
    
    
          "attrId": {
    
    
            "type": "long"
          },
          "attrName": {
    
    
            "type": "keyword",
            "index": false,
            "doc_values": false
          },
          "attrValue": {
    
    
            "type": "keyword"
          }
        }
      },
      "brandId": {
    
    
        "type": "long"
      },
      "brandImg": {
    
    
        "type": "keyword",
        "index": false,
        "doc_values": false
      },
      "brandName": {
    
    
        "type": "keyword",
        "index": false,
        "doc_values": false
      },
      "catalogId": {
    
    
        "type": "long"
      },
      "catalogName": {
    
    
        "type": "keyword",
        "index": false,
        "doc_values": false
      },
      "hasStock": {
    
    
        "type": "boolean"
      },
      "hotScore": {
    
    
        "type": "long"
      },
      "saleCount": {
    
    
        "type": "long"
      },
      "skuId": {
    
    
        "type": "long"
      },
      "skuImg": {
    
    
        "type": "keyword",
        "index": false,
        "doc_values": false
      },
      "skuPrice": {
    
    
        "type": "keyword"
      },
      "skuTitle": {
    
    
        "type": "text",
        "analyzer": "ik_smart"
      },
      "spuId": {
    
    
        "type": "keyword"
      }
    }
  }
}
  1. Migrate the current data and migrate the product data to gulimall_product
POST _reindex
{
    
    
  "source": {
    
    
    "index": "product"
  },
  "dest": {
    
    
    "index": "gulimall_product"
  }
}

  1. The new index operation is completed and the index name in the project needs to be modified.
    Insert image description here

Guess you like

Origin blog.csdn.net/weixin_44847885/article/details/131105084