Create a custom parser that will separate the indexed text into tokens with commas.
Then you can try to perform a search. If you do not need relevance, you can use a filter to search for documents. My example shows how you can try to search using a term filter .
Below you can find how to do this using the sense plugin.
DELETE testindex PUT testindex { "index" : { "analysis" : { "tokenizer" : { "comma" : { "type" : "pattern", "pattern" : "," } }, "analyzer" : { "comma" : { "type" : "custom", "tokenizer" : "comma" } } } } } PUT /testindex/_mapping/yourtype { "properties" : { "contentType" : { "type" : "string", "analyzer" : "comma" } } } PUT /testindex/yourtype/1 { "contentType" : "1,2,3" } PUT /testindex/yourtype/2 { "contentType" : "3,4" } PUT /testindex/yourtype/3 { "contentType" : "1,6" } GET /testindex/_search { "query": {"match_all": {}} } GET /testindex/_search { "filter": { "term": { "contentType": "6" } } }
Hope this helps.
source share