Logstash index is not having the autosuggestions

i've been trying to populate the data from postgresql db to elasticsearch7.17 using logstash.

The data is imported but it's missing the autosuggestions and fuzzy logic suggestions which is needed to query from django api on Elasticsearch

How shall i get those suggestions along with data and index when i import it using logstash.

the logstash index mapping is as below.

{
  "logstash_itsm_incidents_parent": {
    "mappings": {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "@version": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "account_id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "closed_at": {
          "type": "date"
        },
        "description": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "incident_number": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "incident_parent_id": {
          "properties": {
            "account_id": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "company": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "impact": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "incident_number": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "incident_state": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "issue_type": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "resolved_at": {
              "type": "date"
            },
            "resolved_by": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "site_id": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "state": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "sub_account_id": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "sub_site_id": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "urgency": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            }
          }
        },
        "short_description": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "site_id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "state": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "sub_account_id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "sub_site_id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    }
  }
}

the expected one is as below.

{
  "itsm_incidents": {
    "mappings": {
      "properties": {
        "account_id": {
          "type": "text"
        },
        "closed_at": {
          "type": "date"
        },
        "description": {
          "type": "text"
        },
        "incident_number": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "text",
              **"analyzer": "keyword"**
**            },**
**            "suggest": {**
**              "type": "completion",**
**              "analyzer": "simple",**
**              "preserve_separators": true,**
**              "preserve_position_increments": true,**
**              "max_input_length": 50**
**            }**
          }
        },
        "incident_parent_id": {
          "properties": {
            "account_id": {
              "type": "text"
            },
            "company": {
              "type": "text"
            },
            "impact": {
              "type": "text"
            },
            "incident_number": {
              "type": "text"
            },
            "incident_state": {
              "type": "text"
            },
            "issue_type": {
              "type": "text"
            },
            "resolved_at": {
              "type": "date"
            },
            "resolved_by": {
              "type": "text"
            },
            "site_id": {
              "type": "text"
            },
            "state": {
              "type": "text"
            },
            "sub_account_id": {
              "type": "text"
            },
            "sub_site_id": {
              "type": "text"
            },
            "urgency": {
              "type": "text"
            }
          }
        },
        "incident_state": {
          "type": "text"
        },
        "short_description": {
          "type": "text"
        },
        "site_id": {
          "type": "text"
        },
        "state": {
          "type": "text"
        },
        "sub_account_id": {
          "type": "text"
        },
        "sub_site_id": {
          "type": "text"
        }
      }
    }
  }
}

right now i've imported data using logstash_itsm_incidents and reindex to itsm_incidents with suggestions. this is kind of manual work. I'm planning to build a global search for our product using Elasticsearch.

so for each feature such as problem, change, incident, service req.. knowledge base do i have to do that manually reindex ?

what is the efficient way to have suggestions added to the field when logstash imports the data ?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.