Need some help to get started

Hi there,

I'm new to elastic search and I'm not sure how to proceed.

I have a lot of documents indexed, and I'd like to search for them using
their name field, which are composed of many words, using some fuzziness
to fix any misspelling. And I'd like to sort by closeness between the
query and the name, with exact matches first, and if query exactly
matches name it goes first (having additional words in name should not
be before it), with some custom boosting (negative or positive) based on
other fields of the documents.

I'd also like to search in title field if name is not specified, but I
don't want searches with both title and name to have a higher score.

And if possible remove any result that are less than half the first
result score.

example :

doc1: {name:'market tower toilet', title:'market tower toilet',
amenity:'toilet'}
doc2: {name:'market tower', tourism:'attraction'}
doc3: {title:'tower market viewpoint'}

I want a negative boost on amenity:'toilet' and a positive one on
tourism:'attraction'

So search market should yield : doc2/doc3/doc1

Right now I have :
query: {
boosting: {
positive: {
bool: {
should: [
{
custom_boost_factor: {
query: {
match_phrase: {
name: search
}
},
boost_factor: 2.0
}
},
{
fuzzy_like_this: {
fields: ["name"],
like_text: search,
boost: 1.0
}
}
]
},
},
negative: {
term: {
amenity: 'toilet'
}
},
negative_boost: 0.2
}
}
but I feel like this is not how I'm supposed to do it.

I'd like some pointer to start in the right direction.

Thanks!
Charly

--