elasticsearch


Multi prefix search with multi keys


A user wants to search a person by name and enter therefore something like:
"Pe Lu"
"Peter L"
"Lustig P"
All of these should match "Peter Lustig".
The data is indexed with default settings having firstname and lastname split.
I tried to use default prefix search using a bool "should" query having splitted the search term by whitespace.
bool
should
prefix
firstName Pe
prefix
name Pe
prefix
firstName Lu
prefix
name Lu
But I do not get any results for this. What is the best way to achieve this?
Can you try following query:;
{
"query": {
"bool": {
"should": [
{
"match_phrase_prefix": {
"firstName": "Peter"
}
},
{
"match_phrase_prefix": {
"firstName": "Lu"
}
},
{
"match_phrase_prefix": {
"lastName": "Peter"
}
},
{
"match_phrase_prefix": {
"lastName": "Lu"
}
}
]
}
}
}

Related Links

Difference between a “plain” terms query and a terms query using a filter
Elasticsearch: Updating a field that has been set as a document _id via mapping with a path
Return parent data with child document from Elasticsearch
Elasticsearch Giving Incorrect Result When Using “must_not” operator alongwith “must” Operator
ElasticSearch _suggest queries are case sensitive. Want them to be case insensitive
How to normalize periods in elastic search query (such that JJ Abrams == J.J Abrams)?
Elastic Search - Sort By Doc Type
ElasticSearch Filtering aggregations from array field
Full text search for exact match_phrase (with leading and trailing whitespace) in elasticsearch
Do two equal documents in elasticsearch double the needed disc space
In logstash/ElasticSearch/Kibana, how do I augment records following a particular stateful request?
How to know which shard is overloaded in Elasticsearch?
ElasticSearch - searching different doc_types with the same field name but different analyzers
ELK Type Conversion - Not a number but a string
How to get the definitiion of a search analyzer of an index in elasticsearch
ElasticSearch query using match or term?

Categories

HOME
visual-studio
orientdb
verification
vagrant
odata
iverilog
autocomplete
qooxdoo
openflow
greasemonkey
mosquitto
turbojpeg
position
parsley.js
spring-jpa
complexity-theory
texas-instruments
android-contacts
checkout
opam
fluent-migrator
acl
channel
restier
software-packaging
tracing
webviewclient
multi-dimensional-scaling
fstar
network-analysis
gravity-forms-plugin
javax.persistence
cmis
android-canvas
keyboard-layout
installanywhere
mv
xll
optionaldataexception
oracle-bmcs
jshint
axis
aws-kinesis-firehose
photoswipe
nonlinear-functions
sonicmq
visual-format-language
android-mediarecorder
portability
adobe-reader
bigdecimal
xcode6.4
gcloud-node
msbuild-4.0
traversable
textblock
management-studio-express
wif4.5
diawi
miniconda
place
embeddedwebserver
flow-js
mgwt
mod-auth-openidc
dc
inputbox
storing-data
mobile-country-code
nidaqmx
angular-ui-select
two.js
code-complexity
proxy-server
colon
infinite
rautomation
objective-c-runtime
pacman
cgrectmake
spark-view-engine
gamesalad
hardcode
nsfont
algol68
netstream
type-safety
server-variables
kohana-auth
asp.net-mvc-views
dip
turbine
icicles
reliability
wmd-editor
accumulator
regioninfo
remote-working
service-factory

Resources

Encrypt Message