doprdele/pidpid

Re-do all indexes with new mapping as closely as possible

Opened this issue · 0 comments

Based on the new mapping

{
    "mappings": {
        "availability": {
            "_parent": {
                "type": "items"
            },
            "properties": {
                "timestamp": {
                    "type": "date"
                },
                "quantity": {
                    "type": "integer"
                },
                "size": {
                    "type": "text"
                },
                "variant": {
                    "type": "text"
                },
                "inStock": {
                    "type": "boolean"
                }
            }
        },
        "likes": {
            "_parent": {
                "type": "items"
            },
            "properties": {
                "timestamp": {
                    "type": "date"
                },
                "user": {
                    "type": "string"
                }
            }
        },
        "items": {
            "properties": {
                "description": {
                    "type": "text"
                },
                "brand": {
                    "type": "text"
                },
                "url": {
                    "type": "text",
                    "index": "not_analyzed"
                },
                "pid": {
                    "type": "text"
                },
                "timestamp": {
                    "type": "date"
                },
                "sku": {
                    "type": "string"
                },
                "price": {
                    "type": "float"
                },
                "currency": {
                    "type": "text"
                },
                "updated_attributes_timestamp": {
                    "type": "date"
                },
                "created_at": {
                    "type": "date"
                },
                "labels": {
                    "type": "text"
                },
                "image": {
                    "type": "text",
                    "index": "not_analyzed"
                },
                "image_text": {
                    "type": "text"
                },
                "live": {
                    "type": "boolean"
                },
                "_pidpid_likes": {
                    "type": "string"
                },
                "_pidpid_uuid": {
                    "type": "string"
                }
            }
        }
    }
}

Reindex for pids with leading 0s:

POST _reindex
{
  "source": {
    "index": "size"
  },
  "dest": {
    "index": "size_idx1"
  },
  "script": {
    "inline": "ctx._id = '000000'.substring(ctx._id.length()) + ctx._id;",
    "lang": "painless"
  }
}