I am using ES 1.6.0 and LS 1.5.0 . I am parsing CSV file and store it to ES. Since I am in Dev environment so I am changing my LS conf file regularly, e.g applying different filters , mutate etc. Now every time I make some changes in the conf file I have to recreate the index with the different name , else LS is not able to create index in ES.It is not just with the index name I have to change the name of the CSV file as well. Got lots of suggestions like (Delete index from API , Delete Documents rather index, Delete index from Directory , Clear index Cache etc ) but still no solution to this problem . Now because of this problem I have multiple CSV files (same data but with different name) and multiple indexes (same no of documents but with different index name). Please suggest How i can rid of with this situation ?
My observation
I was checking ES logs. I observed if I use same CSV file name or Index name , it adds a client node into the cluster which has blank documents.I am using all the default settings for ES and LS i.e no change in the yml files .
ES log
[2015-06-22 14:04:53,943][INFO ][node ] [Cloak] started
[2015-06-22 14:04:54,952][INFO ][cluster.service ] [Cloak] added {[logstash-LP-54EE752450D4-9468-9796][3jjhY28IQUGEvoc-qUjhrQ][LP-54EE752450D4][inet[/10.92.16.118:9302]]{data=false, client=true},}, reason: zen-disco-receive(join from node[[logstash-LP-54EE752450D4-9468-9796][3jjhY28IQUGEvoc-qUjhrQ][LP-54EE752450D4][inet[/10.92.16.118:9302]]{data=false, client=true}])
The problem with the file is likely to be a sincedb one.
However LS should just keep indexing to the existing index in LS, that shouldn't be a problem. Why do you think you have to delete the index, are you getting errors?
No ! I am not getting any error . Let me explain my Senior--lets say I want to change the data type for one filed e.g Employee_salary from string to integer , for this I need to use Mutate filter . Now to apply this I have to stop ES , LS and edit conf file . Here is the problem ,If I am using same csv file and same index name LS is not able to create/store index in ES so to get it done I have to change the index name along with csv file name . My LS conf file is like
So every time I make some changes in the above conf file I have to create new Index (test1,test2, and so on ) along with csv file name (class1, class2 .....and so on ). My question why i cannot perform or update changes on the same index by using same CSV file . Earlier I was thinking because Index has already been created , so I cannot update it using LS . That is why I tried to delete it .
You don't need to change the filename, that's a sincedb problem as I mentioned.
As for the ES "problem", then yes, if you change the mapping like that then deleting the index and then reindexing is the best option as mixing different field mappings is a bad thing.
Since it is a sincedb issue , so can we resolve this ? I changed "start_position =>"end" and keep the same file name , still no luck . I changed the index name but used same file name as mentioned "class1". LS is not bale to create index in ES. It seems LS reads the file , parse it but not able to send it ES. In KOPF plugin I can see 2nd node has been added but new index has not been created .
OK , I get it , Since I was mentioning "start_position =>"end" so every time it reads from the beginning so after inserting some new rows to the csv file LS immediately creates an index .
However, after I deleted the index using curl -XDELETE and try to run the same command, the index was not created in ES. Below are the last few lines of logstash output:
Rename index name and data file name which you are parsing . I know this is not a good solution but I guess you will understand it batter if you know more about sincedb and LS file filter.
First let me make you understand how file plugin works . When you mention start position to beginning LS will start parsing data file from 1st row till end , so at this point LS set a pointer(sincedb) at the last row of the file . Now the next time you parse the same file without any new data to the log file LS will not create index because file already been read by LS and pointer(sincedb) is set to last row.If you add new row at the end of the log file you will see that will be parsed and so on .So simply deleting index won't work here . You need to either set the pointer(sincedb) to the beginning or use new index name along with data file
Solution 2:- Use sincedb path in file filter something like
Now you just need to delete the cust1_comma from sincedb_path which will reset pointer for you .Now do whatever you want , delete index , recreate it blah blah ....
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.