GET news_headlines/_search
{
"query": {
"simple_query_string" : {
"query": "\"shape of you\" a song of Ed ",
"fields": ["headline^2", "short_description"],
}
}
}
How can I apply stop word on the query? I want to filter such words like a and of (the one that is out of double quotes).
The desired query response should be same as such query:
GET news_headlines/_search
{
"query": {
"simple_query_string" : {
"query": "\"shape of you\" song Ed",
"fields": ["headline^2", "short_description"],
}
}
}
note that the of in the shape of you is still there!
After adding the analyzer I tried to query like this:
GET news_headlines/_search
{
"query": {
"simple_query_string" : {
"query": "\"shape of you\" a song of Ed ",
"fields": ["headline^2", "short_description"],
"analyzer": "custom_english"
}
}
}
but didin't work. and the of inside the shape of you was eliminated and that is not i want.
The analyzer needs to be applied at index time. Which means it needs to be set when you create the index within the mapping section on each field where you want to use it.
It would be something like this described below. You define the analyzer using stop words and all data will be indexed without stop words in English.
When you run the query, your term will eliminate stop words.
For example, if you search just for "of" you will not have any results because this filter was applied in the indexing.
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.