To enhance my search result obtained from elastic search I want to increase my stop word library from my java code. Till now , I am using the default list of stop analyzer which do not have the interrogative words in list like What,Who,Why etc. We want to remove these words and some additional words from our search when querying for result. I have tried code from here(the last ans) tried
PUT /my_index
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"type": "standard",
"stopwords": [ "and", "the" ]
}
}
}
} }
This code in java. But It wasn' working for me. Important Query
How to create our own list of stopwords and how to implement it in our code with query
QueryStringQueryBuilder qb=new QueryStringQueryBuilder(text).analyzer("stop");
qb.field("question_title");
qb.field("level");
qb.field("category");
qb.field("question_tags");
SearchResponse response = client.prepareSearch("questionindex")
.setSearchType(SearchType.QUERY_AND_FETCH)
.setQuery(qb)
.execute()
.actionGet();
SearchHit[] results = response.getHits().getHits();
System.out.println("respose-"+results.length);
Currently I am using default stop analyzer. Which just stop a limited stop words like
"a", "an", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"
But I want to increase this library.