Queries in ES


(olechafm) #1

I've got a cluster with such index:

{

state: open
settings: {
    index.analysis.analyzer.default.filter: my_filter
    index.number_of_replicas: 1
    index.analysis.filter.my_filter.type_table.-: ALPHANUM
    index.analysis.filter.my_filter.preserve_original: 1
    index.analysis.filter.my_filter.type: word_delimiter
    index.number_of_shards: 4
    index.analysis.analyzer.default.type: custom
    index.analysis.analyzer.default.tokenizer: whitespace
}
mappings: {
    test123: {
        properties: {
            wojewodztwo: {
                type: string
            }
            _pk: {
                type: long
            }
            _insertDateTime: {
                type: long
            }
            nazwa_zam: {
                type: string
            }
            przedmiot_zam: {
                type: string
            }
            IDwykonawcy: {
                type: string
            }
            _insertUsec: {
                type: long
            }
            wartosc: {
                type: float
            }
            nazwa: {
                type: string
            }
            data_publikacji: {
                type: integer
            }
            CPV_nazwa: {
                type: string
            }
        }
    }
}
aliases: [ ]

}

and I'm quering elasticsearch in ElasticSearch Head with:

{

query: {
    bool: {
        must: [
            {
                fuzzy: {
                    przedmiot_zam: {
                        value: R-A
                        min_similarity: 0.9
                    }
                }
            }
        ]
        must_not: [ ]
        should: [ ]
    }
}
from: 0
size: 50
sort: [ ]
facets: { }

}

and than through PHP with:

Array ( [from] => 0 [size] => 0 [sort] => Array ( [0] => Array
( [_score] => desc ) ) [query] => Array ( [bool] => Array ( [must] =>
Array ( [0] => Array ( [fuzzy_like_this] => Array ( [fields] => Array
( [0] => przedmiot_zam ) [like_text] => R-A [min_similarity] =>
0.9 ) ) ) [must_not] => Array ( ) [should] => Array ( ) ) ) [facets]
=> Array ( ) )

question: why am I getting diferent query results? in elastic head I
have proper ones in PHP not

I want elasticsearch to ignore the "-" and don't treat it as delimiter
so when I will search for "e-learning" it will find only it, not all
"e" "-" and "learning"


(Ævar Arnfjörð Bjarmason) #2

On Thu, Jun 21, 2012 at 2:10 PM, olechafm olechafm@gmail.com wrote:

question: why am I getting diferent query results? in elastic head I
have proper ones in PHP not

When I encounter this kind of problem I use a network sniffer to see
how the two queries are actually different on the HTTP level.

If it turns out to be a bug in the PHP library maybe you should email
its author directly.


(Marcin Oleszkiewicz) #3

It of course was my mistake, as i discovered, fuzzy is not equal to
fuzzy_like_this and mainly it was the reason of different search
results..

On 22 Cze, 13:31, Ævar Arnfjörð Bjarmason ava...@gmail.com wrote:

On Thu, Jun 21, 2012 at 2:10 PM, olechafm olech...@gmail.com wrote:

question: why am I getting diferent query results? in elastic head I
have proper ones in PHP not

When I encounter this kind of problem I use a network sniffer to see
how the two queries are actually different on the HTTP level.

If it turns out to be a bug in the PHP library maybe you should email
its author directly.


(system) #4