Created
March 18, 2011 16:05
-
-
Save wizidot/876335 to your computer and use it in GitHub Desktop.
simple search term
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is my analyzer configuration : | |
index: | |
analysis: | |
analyzer: | |
default: | |
type: custom | |
tokenizer: whitespace | |
filter:[standard, lowercase, snowball] | |
motcle: | |
tokenizer: keyword | |
filter: [lowercase] | |
filter: | |
snowball: | |
type: snowball | |
language: French | |
This a exemple of document : | |
{"LEADID":"351877000000101651", | |
"SMOWNERID":"351877000000040003", | |
"NAME":"Cr\u00e9dit Mutuel", | |
"TEL":"0820806299", | |
"WEB":"http:\/\/www.creditmutuel.fr", | |
"created":"2011-03-18 10:06:48", | |
"modified":"2011-03-18 10:06:48", | |
"ADRESSE":"8 r Aristide Dumont", | |
"VILLE":"CREST", | |
"CP":"26400", | |
"PAYS":"france", | |
"OPTOUT":"false", | |
"location":"44.7274372,5.0244971", | |
"cat1":"Banques"} | |
this is my mapping : | |
curl -XPOST localhost:9200/places -d '{ | |
"mappings": { | |
"place": { | |
"properties": { | |
"CP" : { | |
"type" : "integer", | |
"analyzer" : "motcle", | |
"boost" : "2" | |
}, | |
"VILLE" : { | |
"type" : "string", | |
"store" : "yes", | |
"index" : "analyzed", | |
"boost" : "2" | |
}, | |
"PAYS" : { | |
"type" : "string", | |
"store" : "yes" | |
}, | |
"ADRESSE": { | |
"type": "string", | |
"store": "yes", | |
"index": "no" | |
}, | |
"TEL": { | |
"type": "string", | |
"store": "yes", | |
"index": "no" | |
}, | |
"TELECOPIE": { | |
"type": "string", | |
"store": "yes", | |
"index": "no" | |
}, | |
"EMAIL": { | |
"type": "string", | |
"store": "yes", | |
"index": "no" | |
}, | |
"OPTOUT": { | |
"type":"boolean", | |
"index":"no", | |
"store":"yes", | |
"null_value":"0" | |
}, | |
"WEB": { | |
"type": "string", | |
"store": "yes", | |
"index": "no" | |
}, | |
"CODE_NAF": { | |
"type": "string", | |
"store": "yes", | |
"index": "no" | |
}, | |
"NAME": { | |
"type" : "string", | |
"store" : "yes", | |
"index" : "analyzed", | |
"boost" : "2" | |
}, | |
"LIBELLE_NAF": { | |
"type" : "string", | |
"store" : "yes", | |
"index" : "analyzed", | |
"boost" : "1" | |
}, | |
"location" : { | |
"type" : "geo_point" | |
}, | |
"created": { | |
"type": "date", | |
"format" : "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd", | |
"store": "no" | |
}, | |
"modified": { | |
"type": "date", | |
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd", | |
"store": "no" | |
}, | |
"active":{ | |
"type":"boolean", | |
"index":"no", | |
"store":"yes" | |
}, | |
"LEADID": { | |
"type": "string", | |
"store": "yes", | |
"index": "no" | |
}, | |
"CONTACTID": { | |
"type": "string", | |
"store": "yes", | |
"index": "no" | |
}, | |
"ACCOUNTID": { | |
"type": "string", | |
"store": "yes", | |
"index": "no" | |
}, | |
"SMOWNERID": { | |
"type": "string", | |
"store": "yes", | |
"index": "no" | |
}, | |
"cat1": { | |
"type" : "multi_field", | |
"fields" : { | |
"cat1" : { | |
"omit_term_freq_and_positions" : false, | |
"omit_norms" : false, | |
"store" : "yes", | |
"term_vector" : "no", | |
"type" : "string", | |
"index" : "analyzed", | |
"boost" : 2.3 | |
}, | |
"untouched" : { | |
"omit_term_freq_and_positions" : true, | |
"omit_norms" : true, | |
"store" : "yes", | |
"type" : "string", | |
"term_vector" : "no", | |
"index" : "not_analyzed" | |
} | |
} | |
}, | |
"cat2": { | |
"type" : "multi_field", | |
"fields" : { | |
"cat2" : { | |
"omit_term_freq_and_positions" : false, | |
"omit_norms" : false, | |
"store" : "yes", | |
"term_vector" : "no", | |
"type" : "string", | |
"index" : "analyzed", | |
"boost" : 2.2 | |
}, | |
"untouched" : { | |
"omit_term_freq_and_positions" : true, | |
"omit_norms" : true, | |
"store" : "yes", | |
"type" : "string", | |
"term_vector" : "no", | |
"index" : "not_analyzed" | |
} | |
} | |
}, | |
"cat3": { | |
"type" : "multi_field", | |
"fields" : { | |
"cat3" : { | |
"omit_term_freq_and_positions" : false, | |
"omit_norms" : false, | |
"store" : "yes", | |
"term_vector" : "no", | |
"type" : "string", | |
"index" : "analyzed", | |
"boost" : 2.1 | |
}, | |
"untouched" : { | |
"omit_term_freq_and_positions" : true, | |
"omit_norms" : true, | |
"store" : "yes", | |
"type" : "string", | |
"term_vector" : "no", | |
"index" : "not_analyzed" | |
} | |
} | |
}, | |
"RUBRIQUE_PROFESSIONNELLE": { | |
"type" : "multi_field", | |
"fields" : { | |
"RUBRIQUE_PROFESSIONNELLE" : { | |
"omit_term_freq_and_positions" : false, | |
"omit_norms" : false, | |
"store" : "yes", | |
"term_vector" : "no", | |
"type" : "string", | |
"index" : "analyzed", | |
"boost" : 1 | |
}, | |
"untouched" : { | |
"omit_term_freq_and_positions" : true, | |
"omit_norms" : true, | |
"store" : "yes", | |
"type" : "string", | |
"term_vector" : "no", | |
"index" : "not_analyzed" | |
} | |
} | |
} | |
} | |
} | |
} | |
}' | |
/******************** SEARCH cat1 */ | |
I would like search the term "banque" in cat1, do i use the good analyzer for this (it's the default analyzer normally who is used because nothing is specified in the mapping of cat1) ? | |
curl -XGET http://localhost:9200/places/place/_search -d '{"query" : {"term" : {"cat1" : "banque"}}}' >> no results | |
curl -XGET http://localhost:9200/places/place/_search -d '{"query" : {"term" : {"cat1" : "Banqu"}}}' >> results | |
thanks... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment