Filter split issue


(Sanjeev Rathaur) #1

I am using elasticsearch 1.4 . I am facing problem in filters in elasticssearch as :

If I write "20 Inch", I will create filter two filter with same product counter like :slight_smile:

20 (7)
Inch(7)
So basically it will spit on space. How do i solve it. Here is my code snippet.

 private String getProductMappings() {
	XContentBuilder builder = null;

	try {
	    builder = XContentFactory.jsonBuilder().startObject().startObject("product")
		    .startObject("properties");
	    			builder.startObject("title").field("type", "multi_field").field("include_in_root", true)
	    					.startObject("fields")
	    						.startObject("title").field("type", "string").field("analyzer", "title_full_ana").endObject()
	    						.startObject("title_partial").field("type", "string").field("search_analyzer", "title_full_ana").field("index_analyzer", "title_partial_ana").endObject()
	    					.endObject()
	    			.endObject()
	    			.startObject("vendor").field("type", "nested").field("include_in_root", true)
	    				.startObject("properties").startObject("address").field("type", "nested").field("include_in_root", true)
	    									.startObject("properties")
	    										.startObject("geoLocation").field("type", "geo_point").field("include_in_root", true).endObject()
	    									.endObject()
	    							 .endObject()
	    				.endObject()
	    			.endObject()
	    			.startObject("menuSection").field("type", "nested").field("include_in_root", true).field("store", "yes")
	    				.startObject("sectionName").field("type","string").field("tokenizer","keyword").field("index","not_analyzed").field("store","yes").endObject()
	    				.endObject()
	    			.startObject("customProperties").field("type", "nested").field("include_in_root", true).field("store", "yes").endObject()
	    			.startObject("inventoryItems").field("type", "nested").field("include_in_root", true).field("store", "yes")
	    				.startObject("properties")
	    					.startObject("sellingPrice").field("type","double").field("store","yes").endObject()
	    					.startObject("size").field("type","string").field("store","yes").field("tokenizer","keyword").field("index","not_analyzed").endObject()
	    				.endObject()
	    			.endObject()
	    			.startObject("parentCategories").field("type", "nested").field("include_in_root", true).field("store", "yes")
	    				.startObject("properties")
	    					.startObject("sectionName").field("type","string").field("include_in_root", true).field("index_analyzer","whitespace_analyzer").field("search_analyzer","whitespace_analyzer").endObject()
	    				/*.startObject("sectionName").field("tokenizer","lowercase").field("type","string").field("index","not_analyzed").field("store","yes").endObject()*/
	    				.endObject()
	    			.endObject()
	    			.startObject("path").field("type","string").field("index_analyzer","hierarchy_analyzer").field("include_in_root", true).field("search_analyzer","standard").field("store","yes").endObject()
	    		.endObject()
	    	.endObject().endObject();
	    return builder.string();
	} catch (IOException e) {
	 e.printStackTrace();
	}

	return null;

    }

(David Pilato) #2

May be if you give a full REST example we could understand better what the problem is?

Read this for an example: About the Elasticsearch category


(system) closed #3