3

Pretty sure that I'm doing some huge mistake, but I have no clue how to sort it.

My couchdb river and my index are defined as following:

curl -XPUT 'localhost:9200/_river/my_index/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
    "host" : "localhost",
    "port" : 5984,
    "db" : "my_db",
    "filter" : null
},
"index" : {
    "index" : "my_index",
    "type" : "my_index_type",
    "bulk_size" : "100",
    "bulk_timeout" : "10ms",
    "analysis": {
        "analyzer": {
            "tags_analyzer": {
                "type" : "custom",
                "tokenizer": "lowercase",
                "filter": ["lowercase", "asciifolding"]
            }
        }
    }
},
"mappings": {
    "tags": {
        "properties": {
            "tags": {
                "type": "string",
                "analyzer": "tags_analyzer",
                "boost": 10
            }
        }
    }
}}'

The query is performed through JAVA application:

 QueryStringQueryBuilder queryBuilder = QueryBuilders.queryString(req.getParameter("tags"));
        queryBuilder.defaultField("tags");
        queryBuilder.analyzer("tags_analyzer");
        queryBuilder.analyzeWildcard(true);
        queryBuilder.lowercaseExpandedTerms(true);
        queryBuilder.defaultOperator(QueryStringQueryBuilder.Operator.AND);

        SearchResponse response = client.prepareSearch("idxscopus").setSearchType(SearchType.QUERY_THEN_FETCH).setQuery(queryBuilder)
                .addHighlightedField("tags", 0, 0)
                .setFrom(0).setExplain(true).execute().actionGet();

During the query phase I'm facing a QueryParsingException telling that my custom analyzer is missing:

omqueryery_stringb*default_fieldCtagsdefault_operatorBandanalyzerLtags_analyzerlowercase_expanded_terms#analyze_wildcard#xplain#highlighteldsgsagment_sizenumber_of_fragments;]]]; nested: QueryParsingException[[idxscopus] [query_string] analyzer [tags_analyzer] not found]; }{[BtMQ0EBJQVmFKyJTJMVhSA][idxscopus][1]: RemoteTransportException[[Aardwolf][inet[/10.1.1.2:9300]][search/phase/query]]; nested: SearchParseException[[idxscopus][1]: from[0],size[-1]: Parse Failure [Failed to parse source [:)

What I'm doing wrong? I really need the asciifolding feature on index and search phase.

Thanks!

Klerisson
  • 312
  • 1
  • 2
  • 17
  • After overriding the default analyzer in order to add asciifolding feature and perform the query over _all field the things start to word as expected, although a bit intermittent. – Klerisson Apr 21 '12 at 22:46
  • New headaches ahead :) After setting the elasticsearch.yml as mentioned above the application start to get mad... just sent the same query twice and the hits retrieved were different. Still looking for some explanation. – Klerisson Apr 24 '12 at 01:06
  • Take a look at your mapping (Get mapping API) and make sure it's what you think it is. Can you tell us what the query is that got different results. As you add more docs to elasticsearch it will affect the scoring of others (due to the inverse document frequency part of tf-idf). – ramseykhalaf Sep 10 '13 at 05:46
  • 1
    Querying on the _all field with very large files (100+ large fields) can offer strange results because it essentially a big mash of all the fields included. Showing your mapping and queries will offer more insight. – Michael at qbox.io Mar 25 '14 at 19:10

0 Answers0