Combining filters? Also, query string questions

Hi!

I have made an analyzer which gives me all trigrams of my input (as per
http://www.elastic.co/guide/en/elasticsearch/guide/current/ngrams-compound-words.html).
The thing is, I ALSO want all two letter words (and maybe also one letter
words) to be indexed.

So basically, the string "I like to write my programs in C" would yield:

  • I
  • lik
  • ike
  • to
  • wri
  • rit
  • ite
  • my
  • pro
  • rog
  • ogr
  • gra
  • ram
  • ams
  • in
  • c

Otherwise, it would be impossible to search for short words.

Is there any way to accomplish this?

I got a tip about using multi fields. But I want to search through the
entire document using a query string, and I don't know beforehand which
fields will exist. I currently do this via the _all field, but it didn't
seem like I could use analyzers for different parts of the _all field. Does
this mean I have to set "store":"yes" to all my fields? Or can I combine
query string with multi_match?

... It seems like I found the answer to some of the above questions just by
asking them.

{
"query": {
"query_string":{
"fields": [ "*" ],
"query": "2007",
"minimum_should_match": "-25%",
"lenient": true
}
}
}

When sending the above query to Elastic Search, it will crash if the query
does not resemble a date or time, even though lenient is set to true. Am I
doing something wrong?

Also, minimum_should_match seems to not be working as expected (or at least
as I expected) when using a non-negative number. With only two tokens and a
min match of 75%, results where only one token matches comes up. I could
explain in more detail. but maybe this one deserves its own question.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2bd71b8b-63d8-40eb-994b-9dd194394b24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oh, and here's the stack trace from the leniency crash:

[2015-03-23 16:45:06,310][DEBUG][action.search.type ] [Tagak the
Leopard Lord] [platina][4], node[TeMv1BkeQumIU3zw
OL9ZGA], [P], s[STARTED]: Failed to execute
[org.elasticsearch.action.search.SearchRequest@3cf896] lastShard [true]
org.elasticsearch.search.SearchParseException: [platina][4]:
from[-1],size[-1]: Parse Failure [Failed to parse source [{

"query": {
"query_string":{
"fields": [ "*" ],
"query": "av",
"minimum_should_match": "-25%",
"lenient": true
}
}
}]]
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:681)
at
org.elasticsearch.search.SearchService.createContext(SearchService.java:537)
at
org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:509)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:264)
at
org.elasticsearch.search.action.SearchServiceTransportAction$5.call(SearchServiceTransportAction.java:231)
at
org.elasticsearch.search.action.SearchServiceTransportAction$5.call(SearchServiceTransportAction.java:228)
at
org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:559)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Invalid format: "av"
at
org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:754)
at
org.elasticsearch.index.analysis.NumericDateTokenizer.setValue(NumericDateTokenizer.java:39)
at
org.elasticsearch.index.analysis.NumericTokenizer.incrementToken(NumericTokenizer.java:80)
at
org.apache.lucene.analysis.CachingTokenFilter.fillCache(CachingTokenFilter.java:90)
at
org.apache.lucene.analysis.CachingTokenFilter.incrementToken(CachingTokenFilter.java:55)
at
org.apache.lucene.util.QueryBuilder.createFieldQuery(QueryBuilder.java:217)
at
org.apache.lucene.queryparser.classic.QueryParserBase.newFieldQuery(QueryParserBase.java:473)
at
org.apache.lucene.queryparser.classic.QueryParserBase.getFieldQuery(QueryParserBase.java:465)
at
org.apache.lucene.queryparser.classic.MapperQueryParser.getFieldQuerySingle(MapperQueryParser.java:273)
at
org.apache.lucene.queryparser.classic.MapperQueryParser.getFieldQuery(MapperQueryParser.java:174)
at
org.apache.lucene.queryparser.classic.QueryParserBase.handleBareTokenQuery(QueryParserBase.java:845)
at
org.apache.lucene.queryparser.classic.QueryParser.Term(QueryParser.java:360)
at
org.apache.lucene.queryparser.classic.QueryParser.Clause(QueryParser.java:259)
at
org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:183)
at
org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:172)
at
org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:123)
at
org.apache.lucene.queryparser.classic.MapperQueryParser.parse(MapperQueryParser.java:882)
at
org.elasticsearch.index.query.QueryStringQueryParser.parse(QueryStringQueryParser.java:223)
at
org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:277)
at
org.elasticsearch.index.query.IndexQueryParserService.innerParse(IndexQueryParserService.java:382)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:281)
at
org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:276)
at
org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:665)
... 9 more

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3713e8fc-7dce-42bf-a775-364465e7579e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.