# Logstash index is not having the autosuggestions

**URL:** <https://discuss.elastic.co/t/logstash-index-is-not-having-the-autosuggestions/341866>\
**Category:** Logstash\
**Created:** [August 29, 2023, 8:26am UTC](https://discuss.elastic.co/t/logstash-index-is-not-having-the-autosuggestions/341866 "2023-08-29T08:26:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![uma\_parvathy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/uma_parvathy/32/123696_2.png) [@uma\_parvathy](https://discuss.elastic.co/u/uma_parvathy)\
**Post date:** [August 29, 2023, 8:26am UTC](https://discuss.elastic.co/t/logstash-index-is-not-having-the-autosuggestions/341866/1 "2023-08-29T08:26:45Z")

</div>

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.

```auto
{
  "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.

```auto
{
  "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 ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 26, 2023, 8:27am UTC](https://discuss.elastic.co/t/logstash-index-is-not-having-the-autosuggestions/341866/2 "2023-09-26T08:27:13Z")

</div>

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