When do we need to close and open the index in Elastic search


(Ram Sunka) #1

Hi guys, I have applied analyzer to the index. After that do we need to close and open the index in Elastic search to see the old documents.


(Thiago Souza) #2

The open/close API is just for management. It is not required to open nor close an index through it's lifetime.

I am also not understanding your question. Are you saying that you have changed/updated the index analyzer settings?


(Ram Sunka) #3

Actually, Document is having below two fields:

receiver (With value as AN)
2.receiver_company(With value as AN RailXXX)
When i search with receiver_company, i could see the receiver value as AN in the output. Here is the query:
{
“from”: 0,
“size”: 1,
“query”: {
“bool”: {
“must”: [
{
“match”: {
“receiver_company”: {
“query”: “AN RailXXX”,
“type”: “boolean”
}
}
}
]
}
}
}

but, i could not able to search with the field as receiver and the value as AN. Here is the query:
{
“from”: 0,
“size”: 1,
“query”: {
“bool”: {
“must”: [
{
“match”: {
“receiver”: {
“query”: “AN”,
“type”: “boolean”
}
}
}
]
}
}
}

So we created one analyzer which will disable the stop words and applied on the index. After that, we have added some new documents, which contains stop words. I have executed the second query, we only see new documents. What is the process to see the old documents, which had stop words.


(Thiago Souza) #4

Any changes made to analyzer will be only visible to new documents as the old documents are already processed by the old settings (when stopwords were enabled).

The only way to fix this is by reindexing. I suggest that you create a new index with the proper analyzer settings and reindex everything.


(system) #5

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