Inconsistency while search in ElasticSearch 2.0.0


(Durgesh Kumar) #1

In my project I am doing 3 consecutive steps as 1- INDEXING, 2- SEARCHING, 3-DELETING.
My mapping::

 PUT _template/discoveryes
{
        		"template" : "discoveryes-*",
				"settings" : {
					"number_of_shards" : 3,
					"number_of_replicas" : 0,
					"index": {
						"analysis": {
							"filter": {
							
								"en_stop_filter": {
								  "type": "stop",
								  "stopwords": ["_english_"]
								} , "en_stem_filter": {
								  "type": "stemmer",
								  "name": "english"
								}
							},
							"analyzer": {
							"en_analyzer": {
							  "type": "custom",
							  "filter": ["icu_normalizer", "en_stop_filter", "en_stem_filter", "icu_folding"],
							  "tokenizer": "icu_tokenizer"
							},
							
							"default": {
							  "type": "custom",
							  "filter": ["icu_normalizer", "icu_folding"],
							  "tokenizer": "icu_tokenizer"
							}
						}
						}
					}
				},   
	    		"mappings" : {
					"discoveryes": {
						"_source" : { 
							"enabled" : "true" 
						},
						
							"properties" : {
								"witID" : {
									"type" : "string",
									"index" :"not_analyzed"
								},
								"text" : {
									"type" : "string",
									"analyzer" : "en_analyzer"
								},
								"docID":{
									"type":"string",
									"index" :"not_analyzed"
								}
							}
					}
					
				}
			}

During my 1st operation, I am getting the correct result(means I am indexing few docs and searching some keywords which is giving me correct result and then deleting all the indexed ids).

But I am not getting the same result when I am trying to do the same operation again for same documents.

When I am commenting the delete operation and doing the operations then I am getting correct results everytime, but the problem arises when I include the DELETE operation.
I am doing all these operation using Java.

Code for Search Operation :

SearchRequestBuilder searchBuilder = client
                                .prepareSearch()
                                .setIndices("discoveryes-1")
                                .setTypes("discoveryes").setQuery(qb)
                                .setSize(100);

Code for DELETE Operation :

DeleteResponse rsp = client.prepareDelete().setIndex("discoveryes-1").setType("discoveryes")
                    .setId(witID)
                    .execute()
                    .actionGet();
In the above line of code, the witID is the indexed ID based on which I am deleting.

Could I get some help regarding this?
Thanks


(system) #2